Created
September 10, 2017 11:41
-
-
Save denisraslov/db0f3f1736fd0775242c47c5c4dd83f6 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { getStore } from 'react/store'; | |
import Content from 'react/components/content'; | |
import Header from 'views/header'; | |
const Page = Backbone.View.extend({ | |
render() { | |
const attributes = this.model.attributes; | |
this.headerView = new Header(this.$('.header'), attributes); | |
this.headerView.render(); | |
// set data to the store through dispathing of the action | |
getStore().getState().dispatch({ | |
action: 'SET_TASKS', | |
data: this.model.attributes.tasks | |
}); | |
// use Provider to make react-redux work inside of the component | |
ReactDOM.render(<Provider store={getStore()}> | |
<Content /> | |
</Provider>, | |
$('.content')[0]); | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment