简体   繁体   中英

How to add a query parameter to the URL with react router v3?

I've just converted my application over to React with Redux and on one page I'm creating an item. Instead of opting for a save button I'm just going to automatically save the item when the user stops typing. The problem I have is that if they refresh the page, I want the application to be able to get the item the user created instead of a blank one.

The way I want to be able to handle this occurrence is to add the ID as a query parameter to the URL so when they refresh I know what item to fetch from the API.

How would I add a query parameter to the URL in a react/redux/react-router application?

I want something like website.com/create-item?id=1234

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