React Shared State
npm install react-shared-state
Very simple shared state for your react app.
``jsx
import React from 'react'
import { createProvider, SharedStore } from 'react-shared-state'
class NameStore extends SharedStore {
setName = (newName) => this.setState({name: newName})
}
const NameProvider = createProvider(NameStore)
const HelloComponent = (props) => {
return
export function App() {
return (
)
}
`
yarn add react-shared-state npm install react-shared-state
or
https://soofty.gitbook.io/react-shared-state/quickstart
https://soofty.gitbook.io/react-shared-state/documentation
https://codesandbox.io/s/wy308n0k88
1. mapStateToProps now accepts store instead of store.state as first argumentconnect
2. no longer passes store by it's name to a componentYourProvider.connect` instead of building custom function
3. Preferable way to use connect is
4. Changed Typescript's generics order from TOuterProps, TInnerProps to TInnerProps, TOuterProps \(recompose format\)
getProvider replaced with createProvider\(StoreClass?: class, storeId?: string\)