How would I take a string, and convert it to jsx? For example, if I bring in a string from a textarea, how could I convert it to a React
jsx
textarea
React
You need to use babel with preset react
npm install --save-dev babel-cli babel-preset-react
Add the following line to your .babelrc file:
.babelrc
{ "presets": ["react"] }
Then run
./node_modules/.bin/babel script.js --out-file script-compiled.js
You can find more info here