Skip to content

Instantly share code, notes, and snippets.

@koba04
Last active September 24, 2017 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koba04/48756a6d6020d99bbdca2d6216fd6878 to your computer and use it in GitHub Desktop.
Save koba04/48756a6d6020d99bbdca2d6216fd6878 to your computer and use it in GitHub Desktop.
import React from 'react';
import TestRenderer from 'react-test-renderer';
const Text = (props) => <p>{props.children}</p>;
const App = () => (
<section>
<h1>Hello</h1>
<Text>hogehoge</Text>
</section>
);
const renderer = TestRenderer.create(<App />);
renderer.toJSON();
// {"type":"section","props":{},"children":[{"type":"h1","props":{},"children":["Hello"]},{"type":"p","props":{},"children":["hogehoge"]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment