Created
March 10, 2017 10:21
-
-
Save ojii/9dc09e76437319f46d9d776738af5648 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export class MyComponent extends React.Component { | |
static propTypes = { | |
name: React.PropTypes.string.isRequired | |
}; | |
render() { | |
return <div>{this.props.name}</div>; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
????????????????? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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