diff --git a/README.md b/README.md index 6ac6bcc..fb4f071 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ fit-html is a combination of [lit-html](https://github.com/Polymer/lit-html), we You need the following: ```js -import { connect, createProvider } from 'fit-html'; +import { connect, withStore } from 'fit-html'; import { html } from 'lit-html/lib/lit-extended'; import { createStore } from 'redux'; ``` @@ -33,12 +33,6 @@ const todos = (state = [], action) => { const store = createStore(todos, ['Use Redux']); ``` -Set up redux provider element (this must be at the root of your element tree): -```js -const provider = createProvider(store); -customElements.define('redux-provider', provider); -``` - Define actions and view: ```js function addTodo() { @@ -58,11 +52,14 @@ const render = ({ addTodo, todos }) => html` `; -const TodosApp = connect( +// The withStore mixin is only required for the root element of your +// app. All other 💪-elements will get the redux store from that element. + +const TodosApp = withStore(connect( state => ({ todos: state }), { addTodo }, render -); +), store); customElements.define('todo-app', TodosApp); ``` @@ -74,9 +71,7 @@ customElements.define('todo-app', TodosApp);