Having bookmarkable state
In this recipe, we will introduce the simplest yet powerful pattern of leveraging a URL to maintain and share application state. Unlike more complex state management strategies, embedding state flags directly in the URL doesn’t require in-memory persistence. A static URL allows users to bookmark a specific application state and facilitates the easy sharing of that state with others. We will follow the well-known restful routing pattern and elegantly map application states to readable and shareable URLs.
Let’s create a component that allows us to bookmark and view an entire event list or specific event information.
Getting ready
Before we start implementing a component with bookmarkable state, we need to do the following:
- Create a
Chapter05
/Recipe01
directory – this will be our working directory - Copy the
Api
andEvent
files from theChapter05
/Data
directory in the GitHub repository
How to do it…
Follow...