-
🚀 Feature requestMotivationI’m refactoring a codebase to use as we have a Example
Possible implementationsthis feature probably would be implemented by first plugging some props to |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hey @vitordino 👋, Thank you for opening an issue. We'll get back to you as soon as we can. If you use Reakit at work, you can also ask your company to sponsor us ❤️. |
Beta Was this translation helpful? Give feedback.
-
currently i’m dealing with a custom hook on top of
|
Beta Was this translation helpful? Give feedback.
-
I usually suggest this approach: const state = useDialogState();
React.useEffect(() => {
if (state.visible) {
// onShow
} else {
// onHide
}
}, [state.visible]); You can also create something like But, yes, wapping it within an enhanced hook is also a good option. |
Beta Was this translation helpful? Give feedback.
-
nice @diegohaz thanks for your fast reply, it really helped me 🙌 .. just to be clear, we don’t plan on putting these props on the official API, right? |
Beta Was this translation helpful? Give feedback.
-
Yes, right now I don't think it makes sense including this in the API as this is easily doable in the user land. But I'm glad that you opened the issue so more people can find it if they have a similar need. :) |
Beta Was this translation helpful? Give feedback.
I usually suggest this approach:
Related: https://spectrum.chat/reakit/general/how-to-react-on-dialog-events~710e0748-288e-4196-a030-2243eede50ca
You can also create something like
useUpdateEffect
to handle only updates.But, yes, wapping it within an enhanced hook is also a good option.