Closed zendevil closed 2 years ago
Have you tried converting them to functional comps so that hooks can work? This specific documentation talks about it: https://github.com/reagent-project/reagent/blob/master/doc/ReactFeatures.md#function-components
To quote the docs:
JavaScript functions are valid React components, but Reagent implementation by default turns the ClojureScript functions referred in Hiccup-vectors to Class components.
However, some React features, like Hooks, only work with Functional components. There are several ways to use functions as components with Reagent:
Calling r/create-element directly with a ClojureScript function doesn't wrap the component in any Reagent wrappers, and will create functional components. In this case you need to use r/as-element inside the function to convert Hiccup-style markup to elements, or just return React Elements yourself. You also can't use Ratoms here, as Ratom implementation requires that the component is wrapped by Reagent.
:r> shortcut can be used to create components similar to r/create-element, and the children Hiccup forms are converted to React element automatically.
Using adapt-react-class or :> is also calls create-element, but that also does automatic conversion of ClojureScript parameters to JS objects, which isn't usually desired if the component is ClojureScript function.
Looks like missing :>
when accessing components from JS lib (Auth0Provider), or missing :f>
when needing functional Reagent components.
Clojurians Slack is preferred channel for support and questions.
I'm using the react auth0 library, and the auth0 documentation says the usage is:
So I have the following:
But this is giving me the error: