Skip to content

Instantly share code, notes, and snippets.

@denisraslov
Created September 10, 2017 11:41
Show Gist options
  • Save denisraslov/db0f3f1736fd0775242c47c5c4dd83f6 to your computer and use it in GitHub Desktop.
Save denisraslov/db0f3f1736fd0775242c47c5c4dd83f6 to your computer and use it in GitHub Desktop.
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