Manually editing TinaCMS's edit state
Manually toggling via useEditState
You can manually enter and exit edit mode by tapping into the useEditState hook. You should always have a /pages/admin.{js,tsx} file but in some cases you may want to go into edit mode without going to the /admin or /admin#/logout routes.
In this case you can use the useEditState hook. This will enter you into edit mode (and trigger a TinaCloud login if applicable).
For example, you may wish to provide your editors with a button to login and logout without having to navigate to /admin and /admin#/logout.
Another example is that you may have UI on a page that you only want editors to see.
Note that the tinacms/dist/edit-state (>2kb) code will be in your production bundle with this pattern.