Giter Site home page Giter Site logo

amineafia / react-investigation Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 119 KB

Investigating the different features of React

Home Page: http://react-investigation.surge.sh/

License: MIT License

HTML 3.38% JavaScript 91.79% CSS 4.83%
react es6 webpack redux reducer redux-router middleware

react-investigation's Introduction

Redux branch

In this branch we will be investigating react apps using redux.

Components model

When using Redux, we can recognize two types of components:

Class based Components

This type has no interaction with

Containers

A normal component can be upgraded to a container if it is going to use an action creator and render the result of reducers.

Actions

React uses the word actions to describe what we know as services in Angular. To use Actions we need to specify a helper to fire the action. The helpers are functions to be called on an event (e.g. click...) or using Reacts helpers function (e.g. ComponentWillMount() ). After this step, the helper will call the action creator with the right input. The action creators are the functions where the logic of the action is implemented and encapsulated under a type and optionally a payload.

middlewares

After firing an Action creator it sends the result to all reducers, but a reducer handles data and doesn't need to know the logic behind it. Here where the role of middlewares comes. They stop the action from reaching the reducers, execute the action creator (e.g. make the HTTP call) and fill the payload with the result.

Reducers

A reducer is an action handler. it handles an action based on its type. By handling we mean modifying the application state. and after this modification React will render the new state.

Router (redux-router)

redux router implements th routes in a separate file where it specify the root route in a <Route path="..." component={...}></Route> tag where we specify the path and the component to render for a specific route. Child routes are added by nesting the same tag in it self. default routes are nested with the tag <IndexRoute component={...} />. If a route needs a unique id for each instance of it, the path is followed by and id to be specified in the component (e.g. path="route/:id")

3rd party Components

Because of the modularity of Reacts ecosystem. 3rd party components are handled as normal ones.

Life cycle methods

these are methods that will be executed at a specific state of the component (e.g. when the component is called or when it is destroyed)

Form validation (Form redux)

React applications can use different plugins to manage forms and there validation. One of the most know ones is ReduxForm

react-investigation's People

Contributors

amineafia avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

troytroy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.