Why do we need to understand the ReactJs life cycle methods?

Why do we need to understand the ReactJs life cycle methods?  #javascript

  • When you build an application in ReactJs you will have to split the UI into reusable components and think about each of them in isolation.When the user interacts with our application in ReactJs, for example, by hovering, pressing a key, clicking… These actions trigger many other events on the UI…
  • So, why is understanding lifecycle methods so important?Let’s imagine that you are building an application in ReactJs, for example, a video player app, like Vimeo, Twitch or Youtube .
  • Now, your user is using the player app on his/her laptop and decides to search for a fun video to watch, found the video, and then selected to watch it.Let’s suppose that the player app is consuming only resources like network data and the battery power.After some time watching videos…
  • When we build an application in ReactJs , we can predict different type of actions by the user, placing some hooks and triggers.These triggers and hooks are available by component lifecycle methods in Reactjs.
  • They will help us to create the most efficient piece of the software as possible.To place correctly the hook methods into the components we need to learn more about the four stages of ReactJs component.The ReactJs component goes through the Four following is a little diagram to demonstrate those phases.InitializationIn…

Components are the core of ReactJs. When you build an application in ReactJs you will have to split the UI into reusable components and think about each of them in isolation. When the user interacts…
Continue reading “Why do we need to understand the ReactJs life cycle methods?”

busypeoples/Flow_Chapter_One.md Last active Aug 30, 2017

  • Now that we have type definitions in place, let’s start to build the game.
  • One interesting thing to note is that we needed to give Flow a type definition for the React Component .
  • Our TicTacToe component will keep state of the current game status as well as the board.
  • Our next steps will include refactoring the board and cells to their own respective components and we will add interactivity, so player’s can take turn and start playing.
  • Although it seems like a lot of work is involved upfront for definining and displaying a simple 3 x 3 board, we can already guarantee that the board has 3 rows containing 3 cells.

Why does it make sense to use FlowType or TypeScript when working with JavaScript?
A good approach in answering this question is to build a small game or application
to make the benefits clear.
Continue reading “busypeoples/Flow_Chapter_One.md Last active Aug 30, 2017”

Open-sourcing our #Redux library to sync parts of store state with cookies: #javascript #reactjs #webdev #opensource

  • redux-cookies-middleware is a Redux middleware which watches for changes in Redux state & stores them in browser cookie.
  • Use dot-notation to specify the path of the subsets of the store that has to be synced with cookies.
  • Consider a store with the following shape as an example:

    To sync the auth and with cookies, pass the following object to the middleware:

    { session { name name of the cookie in which the value of session will be synced }, { name name of the cookie in which the value of auth.token will be synced } }

    Value of the path object is another object that takes more configuration options:

    An object of common options for the middleware.

  • It basically takes , reads the synced state from cookies and merges it with the initial state of your application.
  • ( , ( , ) { initialState { auth { token , key }, session }; read stored data in cookies and merge it with the initial state initialState (initialState, paths, ( , ) (req, name)); create store with data stored in cookies merged with the initial state ( reducer, initialState, ([ ( paths, { ( , ) (res, name, value) } ) ]) ); .

redux-cookies-middleware is a Redux middleware which syncs a subset of your Redux store state with cookies.
Continue reading “Open-sourcing our #Redux library to sync parts of store state with cookies: #javascript #reactjs #webdev #opensource”

Where to Fetch Data: componentWillMount vs componentDidMount

Where to Fetch Data: componentWillMount vs componentDidMount  #ReactJS #JavaScript

  • There are two common places to fetch data:

    And just so we’re clear, the function is never a good place to fetch data – or to do anything that’s asynchronous, that changes state in some way, or that causes side effects.

  • This function is called right before the component’s first render, so at first glance it appears to be a perfect place to put data fetching logic.
  • This means the component will render with empty data at least once.
  • In practice, is the best place to put calls to fetch data, for two reasons:

    Using DidMount makes it clear that data won’t be loaded until after the initial render.

  • If you’re still not sure of the best way how to actually make the AJAX call and load data, read my post AJAX Requests in React.

When you need to fetch some data for a React component, where do you do it?
Continue reading “Where to Fetch Data: componentWillMount vs componentDidMount”

Redux: Store Methods: getState(), dispatch(), and subscribe()

#Redux: Store Methods: getState(), dispatch(), and subscribe() by @dan_abramov   #ReactJS

  • We will learn about the Redux Store and demonstrate how its three methods let us implement a counter application.
  • It retrieves the current state of the Redux store .
  • The store binds together the three principles of Redux .
  • I subscribe the render method to this store .
  • The first method of this store is called getState .

Read the full article, click here.


@NaveenS16: “#Redux: Store Methods: getState(), dispatch(), and subscribe() by @dan_abramov #ReactJS”


We will learn about the Redux Store and demonstrate how its three methods let us implement a counter application.


Redux: Store Methods: getState(), dispatch(), and subscribe()

Insights of a Full Stack developer: React.js Concepts

Insights of a Full Stack developer: React.js Concepts  #Javascript #developer #melbourne #IT

  • You can provide React the values for the initial state using the getInitialState function.
  • Is a more complex example showing default values, provided to React by using the getDefaultProps function, which are later overwritten by the component usage.
  • State: Container object for mutable data for example used with input controls.
  • Uncontrolled controls: Form components rendered without a value (or checked) prop.
  • On every data change React re-renders the entire component in memory then uses a diff to apply a patch for what has changed in the DOM.

Read the full article, click here.


@Thecodefinder: “Insights of a Full Stack developer: React.js Concepts #Javascript #developer #melbourne #IT”


Instagram and Facebook have come up with a FrontEnd client library that uses a virtual DOM diff implementation for ultra-high performance.  This works by comparing DOM changes in memory to calculate a patch required to update the DOM:


Insights of a Full Stack developer: React.js Concepts