Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

fhenri42/React-Redux-starterKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-starterKit

  • A simple application to get started with react/redux

Run

Work with it

  • All you need to do is add your own components, in the components folder.
  • To interact with the state, just add an action to the actions folder and connect to you components.
  • Then go to the reducer file and add a condition to the switch, like that you will be able to update the state.

Next step

  • If you need to communicate with a server you will need to check the middleware file.
  • You will need to add a request
  • Example :
const simpleRequest = () => {
  return new Promise((resolve, reject) => {
      request
      .post(`http://localhost:5000/INFO`)
      .set('Accept', 'application/json')
      .send()
      .end((err, res) => {
        if (err) {
          reject(err)
        }
        resolve(res.body)
      })
    })
}
const simpleMiddleWare = info => ({ dispatch, getState }) => {

  return next => action => {
    if (info && action.type && action.type.indexOf('server/') === 0) {
      const serverAction = action.type.split('/')
      simpleRequest.then(res => {
        return next(res)
      })
    }
    return next(action)
  }
}

export default simpleMiddleWare

Contribute

  • Feel free to fork this repo, and if needed submit a merge request!

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published