Created
June 14, 2016 01:17
-
-
Save jsteenkamp/c5df29336a2cbbbf743e82b2b13444de to your computer and use it in GitHub Desktop.
React Stand Alone component with config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only entry point for CSS processed via webpack | |
import '../styles/main.scss'; | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
import { browserHistory } from 'react-router'; | |
import configureStore from './store'; | |
import root, { Root } from './root'; | |
const store = configureStore(root.rootInitialState); | |
const routes = root.rootRoutes(store.getState); | |
store.runSaga(root.rootSaga); | |
let grid = { | |
configData: (data) => { | |
console.log(data); | |
}, | |
renderGrid: (config) => { | |
render( | |
<Root store={ store } history={ browserHistory } routes={ routes }/>, | |
document.getElementById(config) | |
); | |
} | |
}; | |
// rendered by React | |
grid.renderGrid('root'); | |
// or export to global and then render manually via script with grid.render(elemId) | |
window.grid = grid; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment