Inline Handler in JSX

Learn about inline handlers to help to execute the function right in the JSX.

We'll cover the following

The list of stories we have so far is only an unstateful variable. We can filter the rendered list with the search feature, but the list itself stays intact if we remove the filter. The filter is just a temporary change through a third party, but we can’t manipulate the real list yet.

To gain control over the list, make it stateful by using it as initial state in React’s useState Hook. The returned values are the current state (stories) and the state updater function (setStories). We aren’t using the custom useSemiPersistentState hook yet, because we don’t want to open the browser with the cached list each time. Instead, we always want to start with the initial list.

Get hands-on with 1200+ tech skills courses.