Serialize and deserialize React components to JSON
Clone or download
Latest commit 2c52d46 Jul 7, 2018
Permalink
Failed to load latest commit information.
example use npm Apr 20, 2018
src check for null Jun 22, 2018
.babelrc .babelrc Apr 20, 2018
.gitignore ignore example package-lock Apr 26, 2018
.prettierrc .prettierrc Apr 20, 2018
README.md minor Jul 7, 2018
package-lock.json 0.2.0 Jul 3, 2018
package.json homepage Jul 7, 2018

README.md

React Serialize

serialize and deserialize React components to JSON

serialize(
  <div>
    <h1 align="center">
      <blink>Hello</blink>
    </h1>
  </div>
)
deserialize({
  type: "div",
  props: {
    children: {
      type: "h1",
      props: {
        align: "center",
        children: { type: "blink", props: { children: "Hello" } }
      }
    }
  }
})

Install

npm i react-serialize

Example

See CodeSandbox.

API

See src/index.js.

Donate

By buying a beer.