Fragment node type to support <></> JSX syntax?
See original GitHub issueconst view = <>
<h1>{state.count}</h1>
<button onclick={actions.down}>-</button>
<button onclick={actions.up}>+</button>
</>
to avoid writing commas in jsx:
const view = [
<h1>{state.count}</h1>,
<button onclick={actions.down}>-</button>,
<button onclick={actions.up}>+</button>,
];
refs:
by the way, returning an array of elements from root view leads to <undefined></undefined>
in DOM but nested views are rendered as expected
Issue Analytics
- State:
- Created 6 years ago
- Comments:32 (25 by maintainers)
Top Results From Across the Web
Fragments - React
Fragments let you group a list of children without adding extra nodes to the DOM. There is also a new short syntax for...
Read more >JSX Fragment Syntax in TypeScript - Marius Schulz
TypeScript 2.6 added support for JSX fragments. ... A fragment lets us group multiple JSX elements without adding an extra wrapper node.
Read more >Understanding React fragments - LogRocket Blog
Fragments are syntax that allow us to add multiple elements to a React component without wrapping them in an extra DOM node.
Read more >Documentation - JSX - TypeScript
JSX. JSX is an embeddable XML-like syntax. It is meant to be transformed ... TypeScript supports embedding, type checking, and compiling JSX directly...
Read more >Blog - Understanding React Fragments (With Examples)
You should use the React Fragment when you want to add a parent element to fulfill the JSX syntax, but without introducing an...
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
the real problem is not clutter, but allowing isolated (redraw-optimized) components to consist of siblings where the DOM does not allow for arbitary
<div>
insertion. e.g. you can’t wrap several<tr>
or<li>
elements in a<div>
. similarly, the way flexbox works relies on direct children of flex container elements, so one cannot easily wrap them because it prevents proper grouping/wrapping.without fragment support, rather than redrawing several adjacent
<tr>
s in a large recordset, you have to redraw/diff the entire tbody or table.Hyperapp already supports returning arrays from components. This issue is just incorrectly titled and I just fixed it.