Documentation
Cookies
Firebolt makes it easier to work with cookies by making them reactive from anywhere in your app.
If you modify a cookie on the server or in another component, any other components observing the cookie will instantly update.
components/AuthWidget.jsimport { useCookie } from 'firebolt' export function AuthWidget() { const [token, setToken] = useCookie('authToken') return token ? <Profile /> : <LoginButton /> }
In this example, any changes to the authToken
cookie (eg after logging in or out) will toggle the auth widget component between showing the current users profile or showing a login button.
To learn more about cookies, check out the useCookie and Context docs.