File tree Expand file tree Collapse file tree 1 file changed +0
-42
lines changed Expand file tree Collapse file tree 1 file changed +0
-42
lines changed Original file line number Diff line number Diff line change @@ -12,48 +12,6 @@ Very simple shared state for your react app.
1212## Quickstart
1313https://soofty.gitbook.io/react-shared-state/quickstart
1414
15- ### 1. Create provider
16-
17- ``` javascript
18- // simple-provider.js
19- import React from ' react'
20- import { createProvider } from ' react-shared-state'
21-
22- const SimpleProvider = createProvider (' simple_provider' )
23- ```
24-
25- ### 2. Add it to your app root
26- ``` javascript
27- // app.js
28- export function App () {
29- return (
30- < SimpleProvider initialState= {{ name: ' Anonymous' }}>
31- < Hello / >
32- < / SimpleProvider>
33- )
34- }
35- ```
36-
37- ### 3. Use it with your component
38-
39- ``` javascript
40- // hello.js
41- import React from ' react'
42- import { SimpleProvider } from ' ./simple-provider.js'
43-
44- const HelloComponent = (props ) => {
45- < div>
46- < h1> Hello, {props .name } < / h1>
47- < button onClick= {() => props .store .setState ({ name: ' John' })}> Set Name< / button>
48- < / div>
49- }
50-
51- export const Hello = SimpleProvider .connect ((store ) => ({
52- store,
53- name: store .state .name
54- }))(HelloComponent)
55- ```
56-
5715## Documentation
5816https://soofty.gitbook.io/react-shared-state/documentation
5917
You can’t perform that action at this time.
0 commit comments