This repo demonstrates some React weirdness.
I was trying to implement a hook that allows me to do the following:
useOn()
.who(window)
.when('resize')
.what(() => {
console.log('resize!');
});
Don't ask why. I just thought it was pretty.
Turns out you can, but using the approach I came up with, it only works in production.
Can you tell why?
Clone the repo, then:
npm i # yarn
npm start # yarn start
Then follow the instructions you see on the page, you will see my approach failing.
To see it running fine, you'll need to:
npm run start:prod # yarn start:prod
Visit this repo's CodeSandbox, to see it failing (as you did if you ran it on your machine).
Visit this repo's Vercel deployment, to see it running fine.