Closed martinsantibanez closed 2 years ago
I've fixed the issue. Thanks for yet another contribution!
Thanks! really look forward for this as we're soon shipping v15 to prod
I've released v16. You can try it out and let me know if everything works correctly.
@martinsantibanez Just as a question. I don't see real use case where we would explicitly need to set the setter function as a dependency except to shut up the linter.
Do I miss something?
@Ganbin Yep, just to shut up the linter I think. Unless the setter changes, which I'm not sure about
Hello, not sure if this should be taken as a bug or just a question.
Whenever I'm updating the localStorage state inside an effect, I cannot put the setter in the dependencies array. Otherwise, it causes infinite renders.
My workaround is to exclude the setter from the deps array. However, this is a bit unfortunate due to the
react-hooks/exhaustive-deps
eslint rule.How do you deal with this? do you just ignore the
exhaustive-deps
warning?You can see an example here: https://codesandbox.io/s/blissful-faraday-37g5wg?file=/src/App.js
Thanks!