Get State from the Redux Store code example

Example: redux get state without store

/*
* MyStore module
*/

import { createStore } from 'redux'

// action creator
export const setFoo = value => ({type: FOO, value: value})

// init state
const initState = {
	foo: 'foo'
}

// reducer
const reducer = (state = initState, action) => {
  case FOO:
	return { ...state, foo: action.value}
  default:
	return state
}

// create store
export const store = createStore(reducer)


/*
* MyScreen client
*/
import { setFoo, store } from './MyStore'

// selector
const foo = store.getState().foo

// dispatch
store.dispatch(setFoo('bar')