import {connect} from 'react-redux'
import {withLocalState} from 'local-state-hoc'
const View = ({ updateIndex, index }) => (
<div>
<button onClick={updateIndex} />
<p>{index}</p>
</div>
)
const defaultLocalState = {
index: 0
}
const mapStateToProps = (_, { localState, setLocalState }) => ({
updateIndex: () => setLocalState({ index: localState.index + 1 }),
index: localState.index
})
export default withLocalState(connect(mapStateToProps)(View), defaultLocalState)
-
Notifications
You must be signed in to change notification settings - Fork 0
License
jtparrett/local-state-hoc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published