react-pack-unpack
v0.1.0
Published
React component builder that allows for packing and unpacking React components to and from a database
Downloads
4
Readme
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)