简体   繁体   中英

How to implement searching in react native?

In my app I have the search bar and screen with some static text on it. How can I display search results and when you click on one of them open a new page with this result? (I'm not asking you to write code, I want to understand it from the point of view of logic)

Well you would basically create a state for your search string and results. Then you would fetch results based on your search string and store the results in your result state. Then check if your results has some value in it and render it.

To show an individual result on new screen, you create a new screen and navigate to the new screen with the id of the clicked result as your params. then you can use the id from the params and fetch the individual result and display it.

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