Closed bhauman closed 9 years ago
Oh that's why devcards was not work, good to know.
There is a problem with my code above in that it changes the signature of reactify-component to return a ReactElement. Looking at this right now ...
Yeah I spoke too soon. This still needs some examination. Mostly my ignorance ...
Still working out the best way to hold reagent inside Devcards.
Any help I can get here would be great.
And now I am closing this.
I found that as-element provides everything I need. I apologize for the noise.
Devcards relies on the magic in
reactify-component
to do its reloading. But becausereactify-component
creates a "new class" on every call, this "class type change" forces React to do a complete re-render for all the components below it every timereactify-component
gets called. If howeverreactify-component
used a class that was a stable reference then this forced re-rendering doesn't occur.This works for me:
To be clear this isn't just an issue for hot reloading, its a general rendering problem when embedding Reagent in a system that ends up calling
reactify-component
during its render phase.I haven't looked at the rest of Reagent but this trick could probably help with hot reloading in other areas as well.