React render pages
Simple lib for help render components in a dom node with own props; alternative to build routes.
If your app it not a single page application, this package help you to use the same function for render react components like a page
Installation
npm install react-render-pages --save
How work
If you want render your component like a page you need to write something like this.
document
This snippet help to render the component only if the dom node exists and use the data attribute to pass props to the component.
Usage
Example html
renderIn
const Example = )
render
Use es7 decorators
@Component { return <h1>This component render in "#example-domId"</h1>}
ReactDOMRender
Core function to render components
Component { return <h1>This component render in "#example-domId"</h1>}
Example
TODO
- add more examples
- pass context to react page
- test with server render
- use the same component name for render in dom?
- help to make layouts?