Make Store Utility

Loading "Make Store Utility"
๐Ÿ‘จโ€๐Ÿ’ผ We want to make this utility generally useful so we can use it for any media query. So please stick most of our logic in a makeMediaQueryStore function and have that return a custom hook people can use to keep track of the current media query's matching state.
It'll be something like this:
export function makeMediaQueryStore(mediaQuery: string) {
	// ...
}

const useNarrowMediaQuery = makeMediaQueryStore('(max-width: 600px)')

function App() {
	const isNarrow = useNarrowMediaQuery()
	// ...
}
Login to get access to the exclusive discord channel.
  • General
    Welcome to EpicReact.dev! Say Hello ๐Ÿ‘‹
    Kent C. Dodds โ—† ๐Ÿš€๐Ÿ†๐ŸŒŒ:
    Welcome to the first of many posts in the EpicReact.dev channel! Take a moment to introduce yourself...
    0 ยท 4 days ago