What is the plan for dynamic elements?
See original GitHub issueThe current strategy of instrumenting JSX with a babel plugin is really neat! I’m wondering what the plan is to work around the dynamism of JSX when it comes to elements determined at runtime, such as:
Conditional Elements
{someFlag && <Display
{/*What is the plan for working with me and being able to toggle someFlag?*/}
/>}
Lists of Elements
data.map((item) => <div {/*What about the plan here? */} />);
Is your plan to teach the editor about these sorts of syntax expressions and render an interface for displaying these sorts of “dynamic elements”? Alternatively, Blocks could provide <If> and <Map> components to be able to statically work with these sorts things?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Dynamic Elements, Static Elements, Event Handlers and Their ...
When the page loads, two dynamic elements are created. When the first is clicked, it should display the second dynamic element. When the...
Read more >Use dynamic elements in interactive overlays - Vimeo
Dynamic Elements is a feature available in the interactive overlay panel to pull content from any open API and integrate it into the...
Read more >Dynamic Web Elements in Web Automation | by Adil Qayyum
The dynamic element is that Web Element whose IDs, and any other attributes like Class Name, Value etc. are not fixed. It changes...
Read more >What are Dynamic Elements? - KIRUPA
The answer lies in a mysterious creature known as the dynamic element and the role it plays in our everyday lives. In the...
Read more >The Elements of a Dynamic Growth Plan
The Elements of a Dynamic Growth Plan. Time. Frames. Planning Elements. Clarifying Questions. Lo n g. Te rm. 5. – 2. 5. Y...
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 Free
Top 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
Good question!
For now, the strategy I’m thinking is to slowly teach the editor about common syntax expressions. Both dynamic and lists of elements would definitely fall into common!
With dynamic elements based on flags/ternaries I’m hoping to expose the element in the tree (or two elements for a ternary) with a toggle. Will mostly be a matter of locating the syntax at the root level and adding support for it in the blocks selection/editing of the canvas.
Lists are more interesting because we’ll need to search for this syntax and expose the list in some unified interface for editing the rendered component being mapped over. Interestingly we’ll get manipulating the mapped over element for free as a result of the UUID being used to apply props.
Why bother with AST and not use control components?
Instead of this
write this
The advantage is that these proprietary components can attach special interaction and editing possibilities.