Skip to content

Instantly share code, notes, and snippets.

@ojii
Created March 10, 2017 10:21
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 ojii/9dc09e76437319f46d9d776738af5648 to your computer and use it in GitHub Desktop.
Save ojii/9dc09e76437319f46d9d776738af5648 to your computer and use it in GitHub Desktop.
import React from 'react';
export class MyComponent extends React.Component {
static propTypes = {
name: React.PropTypes.string.isRequired
};
render() {
return <div>{this.props.name}</div>;
}
?????????????????
import test from 'tape';
import ReactDOMServer from 'react-dom/server'
import MyComponent from './component';
test('react', t => {
t.plan(1);
const result = ReactDOMServer.renderToStaticMarkup(<MyComponent name='test' />);
t.equal(result, '<div>test</div>');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment