before i use
<Fragment key={index}>
now i use
<>
how add key this ?
< key={index}>
has error
@uxitten Syntax works only for propless fragments. If you need to add key, just use React.Fragment
. There's nothing wrong with it.
@uxitten Docs here:
https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html#keyed-fragments
@pd4d10 thanks i know i can use
@TrySound thanks but why?
@uxitten To not add complexity to the syntax.
@TrySound i thought <>
is just alias <Fragment>
It's syntax extension which is transformed to React.Fragment, not alias
@TrySound thanks
i added this note in docs reactjs.org
https://github.com/reactjs/reactjs.org/commit/2f88a5e7eb960ff072c68d2ef536bc73fd1e051c
Isn't this clean enough?
https://reactjs.org/docs/fragments.html
yes that's enough
Most helpful comment
@uxitten Syntax works only for propless fragments. If you need to add key, just use
React.Fragment
. There's nothing wrong with it.