Example of using routes to control visibility of modals.
Open this example on CodeSandbox:
This example shows how to use routes to show/hide modals.
Using routes has some advantages over useState
or other state management solutions.
- You can share links to open modals (eg. edit modal of a specific data row)
- No need for state variables
This example uses @reach/dialog
for displaying the modals.