https://github.com/jsdf/react-shallow-render
Convenience function for React Shallow Rendering
https://github.com/jsdf/react-shallow-render
Last synced: about 2 months ago
JSON representation
Convenience function for React Shallow Rendering
- Host: GitHub
- URL: https://github.com/jsdf/react-shallow-render
- Owner: jsdf
- License: mit
- Created: 2015-09-14T12:42:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-17T00:32:02.000Z (over 9 years ago)
- Last Synced: 2025-03-06T06:40:54.652Z (about 2 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-shallow-render
Convenience function for React Shallow Rendering```js
import assert from 'assert';
import React from 'react';
import shallowRender from 'react-shallow-render';const rendered = shallowRender(
);
assert.equal(rendered.type, 'div');
assert.equal(rendered.props.className, 'test');
```Please note that as of React 0.14, [shallow rendering won't render
primitives](https://github.com/facebook/react/issues/4721).
[The good thing is that you don't need it](https://github.com/facebook/react/issues/4721#issuecomment-135923690)
as you can just do:```
var el = React.createElement('h1', {}, 'Hello');
console.log(el);
```