0.1.0 • Published 5 years ago
react-pack-unpack v0.1.0
react-pack-unpack
react-pack-unpack
stores simple React components as JSX strings.
install
npm install react-pack-unpack
api
const { pack, unpack } = require('react-pack-unpack')
unpack : (String, Dependencies) -> ReactComponent
let component = unpack(jsxstr, dependencies)
where dependencies
is an object of react components that appear in the jsx string (see example.js
for more clarity)
pack : ReactElement -> (String, Dependencies)
Note: pack
is not exactly complementary to unpack
as pack
takes a ReactElement
and unpack returns a ReactComponent
.
let jsxstr = pack(element)
0.1.0
5 years ago