Skip to content

idletea/jsx-no-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsx-no-react

yarn add jsx-no-react

Usage

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"
		}]
	]
}

About

Use React's JSX without React easily

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published