We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33247af commit d81f862Copy full SHA for d81f862
src/index.ts
@@ -1724,7 +1724,13 @@ function useSubscribedStateMethods<S>(
1724
state.edition,
1725
update,
1726
);
1727
- React.useEffect(() => {
+ // useLayoutEffect here instead of useEffect because of this issue:
1728
+ // https://github.com/avkonst/hookstate/issues/165#issuecomment-824670930
1729
+ // and very likely this issue:
1730
+ // https://github.com/avkonst/hookstate/issues/186
1731
+ // and probably this issue:
1732
+ // https://github.com/avkonst/hookstate/issues/145
1733
+ React.useLayoutEffect(() => {
1734
subscribeTarget.subscribe(link);
1735
return () => {
1736
link.onUnmount()
0 commit comments