yarn add jsx-no-react
The jsx-no-react
package just defines a function to replace the React.createElement
, so as well as importing the relevant function into scope where you want to use JSX:
import jsxElem from 'jsx-no-react';
<div>just do jsx as usual here</div>;
you'll also need to hook the jsxElem
function into the JSX transformation, for which you should probably use babel, which you can install and setup fairly simply:
yarn add babel-plugin-transform-react-jsx babel-preset-env
and configure babel to correctly transform JSX with a .babelrc
something like:
{
"presets": ["env"],
"plugins": [
["transform-react-jsx", {
"pragma": "jsxElem"
}]
]
}