Open bpinto opened 3 years ago
The following is my initial approach:
import { Fragment, createElement } from 'karet'
export function createElementWithJSX (type, props, key, ...args) {
return createElement(type, { ...props, key }, props.children)
}
export {
createElementWithJSX as jsx,
createElementWithJSX as jsxs,
createElementWithJSX as jsxDEV,
Fragment
}
while the components are rendered and I can remove the import * as React from 'karet'
calls, key
handling is not correct since I am seeing a lot of: Warning: Each child in a list should have a unique "key" prop.
warnings.
These warnings are being thrown by any children: Array
that didn't need a key
in the classic runtime, whether they are wrapped or not with a React.Fragment
.
React 17 has introduced support for a new JSX transform.
The old JSX transform would do the following:
code is transformed into:
The new JSX transform would do the following:
code is transformed into: