Browse Source

Add usage example

pull/8/head
Luke Childs 7 years ago
parent
commit
999607c895
  1. 30
      README.md

30
README.md

@ -12,6 +12,36 @@
npm install --save-dev react-jsdom npm install --save-dev react-jsdom
``` ```
## Usage
```js
const React = require('react');
const ReactJSDOM = require('this');
class TestComponent extends React.Component {
render() {
return (
<div>
<span>hi</span>
<span>mum</span>
</div>
);
}
componentDidMount() {
console.log('I mounted!');
}
}
const elem = ReactJSDOM.render(<TestComponent />);
// I mounted!
elem.nodeName;
// 'DIV');
elem.querySelector('span:last-child').textContent
// 'mum'
```
## License ## License
MIT © Luke Childs MIT © Luke Childs

Loading…
Cancel
Save