Thursday, April 14, 2016

REDUX REACT MOCHA




I will start by saying this out that redux is not an independent framework but its a library that can be used with react
So what does redux do it handles the complicity of store management
I will start by describing these terms

  • Container  
       Redux users regard containers as smart  react component . Meaning they contain both react and redux

  • Action creators 
      They receive actions from the containers and they dispatch actions  to the reducers

  •   Reducers 
     They do take in actions and they do check if the action type matches with what they can handle and they return out a new state .  Meaning that they do carry out computations and they update the state

Lets get our hands dirty !!!!!!!

We will start installing redux

npm install --save react-redux

npm install --save-dev redux-devtools


Entry point   
This is the first part that will be accessed when ever the web page request 

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import todoApp from './reducers'
import App from './components/App'

let store = createStore(todoApp)

render(
  
    
  ,
  document.getElementById('root')
)


Explanation :

 




No comments:

Post a Comment