Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Test creating functional components #477
Render/as-element and other functions now take additional parameter for setting options. Currently only option is :functional-reag-elements?, if set to true, by default Reagent components are created as Functions, which behave similarly to Classes, but allow using Hooks.
Creating functional components is now optional, and can be enabled by providing options to render call:
This will affect the tree of components created directly from given component. Using
This is just first version of testing the idea of providing options to control Reagent, but it looks promising. I'm still unsure if having to provide options for
Might be also possible to use Context or maybe even dynamic var, to set the default options for calls without options.
Another problem with this version is, that several of the caches need to be per options, but currently are global. This will probably be solved by creating Compiler type, where Compiler instance contains the state for caches, this compiler is created using the options and then passed to functions.
@@ Coverage Diff @@ ## master #477 +/- ## ========================================== + Coverage 82.90% 83.64% +0.74% ========================================== Files 9 9 Lines 737 795 +58 Branches 123 130 +7 ========================================== + Hits 611 665 +54 - Misses 96 97 +1 - Partials 30 33 +3