-
Once the experimental If the React team add the ability to call Note: I can see there is other usage of hook APIs in this function currently so I know it can't happen as simply as I suggest, but I still think it'd be an interesting step forwards to be able to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, I can consider about skipping internal Meanwhile, please use const useAtomValueWithoutUse = (atom) => {
const store = useStore();
const [value, setValue] = useState(() => store.get(atom));
useEffect(() => store.sub(atom, setValue), [store, atom]);
return value;
}; |
Beta Was this translation helpful? Give feedback.
Oh, were you talking about it?
Of course, I've thought about it, quite a lot.
There are two hurdles:
use(Observable)
or something alike.use()
calls in a non-hook function.It's very unlikely that both are solved at any time soon. So, consider that we don't have a hope.