React
Hook
// overmind/index.js
import { createHook } from 'overmind-react'
import { state } from './state'
import * as actions from './actions'
export const config = {
state,
actions
}
export const useOvermind = createHook()
// index.js
import * as React from 'react'
import { render } from 'react-dom'
import { createOvermind } from 'overmind'
import { Provider } from 'overmind-react'
import { config } from './overmind'
import App from './components/App'
const overmind = createOvermind(config)
render((
<Provider value={overmind}>
<App />
</Provider>
), document.querySelector('#app'))
// components/App.jsx
import * as React from 'react'
import { useOvermind } from '../overmind'
const App = () => {
const { state, actions, effects, reaction } = useOvermind()
return <div />
}
export default AppRendering
Passing state as props
Reactions
Higher Order Component
Rendering
Passing state as props
Reactions
React Native
Last updated