I try to design my components so they take just data and callbacks. I only use context for very specific global things like navigation, or theming, and even then I typically hide that behind a custom hook like use-navigation and use-theme
but that's only for concerns I use everywhere. for instance, if I had a modal component, instead of looking up the current modal content in a global atom and dispatching a global modal-close handler, I would take all of that information as props. The only thing I would look up in a global context would be a theme, hidden behind a use-theme hook
(defnc modal
[{:keys [class children on-close]}]
(let [{:keys [border-primary bg-primary text-primary]}] (use-theme)]
(d/div
{:class (flatten ["floating" border-primary bg-primary text-primary class])}
(d/div children)
(d/div
{:class "right-align"}
(d/button {:on-click on-close} "Close")))))ah cool. So just hooks and local state
I can do that
do you pass callback functions into components
or use a context
I guess local state composes better anyway