Helper for user preference
This MR provides a React-like helper for user preference. Plus a rework of the main sidebar to use it for the collapsed state.
This also fixes the getCache
function in order to be able to store false
/null
/undefined
, which was previously read back as {}
.
This easily can be used to replace a React useState
.
const [state, setState] = React.useState(null)
const [state, setState] = useUserPreference(['foo', 'bar', '2000'], null)