Render (sub)component's variant with handler defined in config
See original GitHub issueWhat is a proper way to {{render ...}}
sub-component with handler defined in parent-component’s config?
Currently in our team we successfully solved this in a wierd way:
{{render '@handler' subComponentContext merge=true}}
where subComponentContext
property is defined in a YAML config as a string "@handler--variant"
. Note that @handler
and @handler--variant
should match the component e.g. name handler
.
In other case we tried in eq. {{render subComponentContext}}
which generates an error.
I’m not sure if our “wierd way solution” is a bug or a feature… 🤔
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Variants - Fractal
Variants are useful when you have one component that has a multiple different possible ... Defining variants in the component's config file.
Read more >Events Fired During the Rendering Lifecycle | Lightning Aura ...
The component lifecycle starts when the client sends an HTTP request to the server and the component configuration data is returned to the...
Read more >Render Props - React
A component with a render prop takes a function that returns a React element and calls it instead of implementing its own render...
Read more >ASP.NET Core Razor component rendering | Microsoft Learn
To render component outside the subtree that is rerendered by a particular event. An asynchronous handler involves multiple asynchronous phases.
Read more >Rendering Plasmic components
When you render a component using <PlasmicComponent /> , you can use the componentProps prop to control which variants to activate, which slots...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For more on using lookups, see here https://github.com/frctl/fractal/issues/278#issuecomment-316977660
@tlenex What’s happening there is that you’re telling Fractal to render
@another-partial
with@another-partial--my-variant
’s context data. By default, any defined views (in this case, the *.hbs file) are included with a variant’s context data, which is why this works. There’s no plan to change this behaviour in v1, but things will work quite differently in v2.