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.
997 B
997 B
react-jsdom
Render actual DOM nodes in Node.js
Install
npm install --save-dev react-jsdom
Usage
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
MIT © Luke Childs