O'Reilly logo

Mastering React by Ryan Vice, Adam Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching posts

Remember that little search box we slipped into the header in our wireframes? We also made the post list a separate component since it appears both on our home view as well as in the user view.

Now, we'll wire that search field to the post list component. The search box is always there, while the post list comes and goes. This is an opportunity to use a store for a purely front-end concern. The search information in the header bar is just a piece of data that various ephemeral components in the application will potentially need. It's like any other application model managed by a store, except that it's not backed by a server request.

The final application code, including the search feature, can be found in the ch9-2.zip code bundle. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required