简体   繁体   中英

Choose one of multiple items react.js

I am trying to make a website for my portfolio and I need some help.

What I want is the client to be able to click on one of pictures and select it and then to get redirected to another page with another options.

I think I should save the choice with a state, but I do not have the proper vision how to proceed. Can you help me or give me an idea?

 <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>

代码的结果

You can use the <Link> component from react-router-dom , like this:

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

You need to make a router for your application too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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