cljsrn 2023-02-16

I noticed a couple of people mentioning that they wrap components to get around a warning in react-navigation, something about an invalid component name. Iโ€™m not sure itโ€™s in the docs, but after digging around in reagentโ€™s code, I found that reagent will take a display-name meta attribute as an override for the name of the component, meaning we can specify SomethingValid` and avoid having to wrap components, or ignore warnings. Hereโ€™s an example:

(r/reactify-component (with-meta (fn name [{:keys [^js route]}]
                                   [component {:route (bean/->clj route)}])
                                 {:display-name display-name}))
hope this helps someone ๐Ÿ™Œ

๐ŸŽ‰ 3

Thank you @dazld! This is very helpful.

๐Ÿ‘ 1

This should be pinned! ๐Ÿ˜† I had to ignore those warnings (using logbox), thanks for sharing this!

๐Ÿ™Œ 1

on another topic - I canโ€™t figure out yet, how to make the navigator not lose state on reload - Iโ€™m using shadow. How do you all handle this?

โœ… 1

answering my own question.. missed the doc page which describes in detail how to do this ๐Ÿ™‚ https://reactnavigation.org/docs/state-persistence

hey, you already answered it, but i add link to similar question asked in this channel before https://clojurians.slack.com/archives/C0E1SN0NM/p1652439790706039?thread_ts=1652431961.516389&cid=C0E1SN0NM

๐Ÿ™Œ 1