You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get that you're trying to provide a "close to the (mental) metal" wrapper around React, but one of the nice things about working in clojure and with clojure data structures with React is that we can take advantage of their immutability to control re-rendering, as with rum's rum/static mixin for shouldComponentUpdate. The functional component equivalent of this is React.memo, a higher-order component for wrapping functional components to only re-render them when the arguments pass a shallow equality test, which I think will suit the nature of working with react from clojure.
I don't know what you'd consider this to look like, perhaps defncs or maybe defstatic, but it would be nice to not have to do this wrapping manually.
The text was updated successfully, but these errors were encountered:
OTOH, perhaps React/memo is both trivial and special enough that adding that as a space option to defnc makes sense? Let me know if you'd like a PR that explores this.
Since we discussed quite a lot about Clojure vs Javascript equality in the useState/useEffect discussion, I was happy to find that it seems that React/memo allows the use of a custom compare function. Still need to try it out to see how it works.
I get that you're trying to provide a "close to the (mental) metal" wrapper around React, but one of the nice things about working in clojure and with clojure data structures with React is that we can take advantage of their immutability to control re-rendering, as with rum's
rum/static
mixin forshouldComponentUpdate
. The functional component equivalent of this isReact.memo
, a higher-order component for wrapping functional components to only re-render them when the arguments pass a shallow equality test, which I think will suit the nature of working with react from clojure.I don't know what you'd consider this to look like, perhaps
defncs
or maybedefstatic
, but it would be nice to not have to do this wrapping manually.The text was updated successfully, but these errors were encountered: