繁体   English   中英

选择多项 react.js 中的一项

[英]Choose one of multiple items react.js

我正在尝试为我的投资组合制作一个网站,我需要一些帮助。

我想要的是客户端能够单击其中一张图片和 select 它,然后使用其他选项重定向到另一个页面。

我想我应该用 state 保存选择,但我不知道如何继续。 你能帮助我或给我一个想法吗?

 <div className="landing_3"> <p className="msg_2"> Customize the perfect gift</p> <p className="msg_3"> Choose one of the options to start with: </p> <div className="landing_3_items"> <img alt="" src={c3} className="landing_img" /> <img alt="" src={c4} className="landing_img" /> <img alt="" src={c5} className="landing_img" /> </div> </div>

代码的结果

您可以使用react-router-dom中的<Link>组件,如下所示:

<Link to="mypage">
    <img src="" />
</Link>

您还需要为您的应用程序制作一个路由器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM