You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
997 B

8 years ago
# react-jsdom
> Render actual DOM nodes in Node.js
[![Build Status](https://travis-ci.org/lukechilds/react-jsdom.svg?branch=master)](https://travis-ci.org/lukechilds/react-jsdom)
[![Coverage Status](https://coveralls.io/repos/github/lukechilds/react-jsdom/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/react-jsdom?branch=master)
[![npm](https://img.shields.io/npm/v/react-jsdom.svg)](https://www.npmjs.com/package/react-jsdom)
## Install
```
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'
```
8 years ago
## License
MIT © Luke Childs