redux-dsm is an easier way to handle async state. v3.0.0 has simplified state graphs. Yay! #reactjs #redux

  • Since I switched to Redux, I handle all of my view state transitions by dispatching action objects, and that requires writing a bunch of boilerplate, such as action types (e.g., ), and action creators (which your view or service layers can call to create actions without forcing you to import…
  • is an object with camelCased keys and strings corresponding to your state transitions.
  • For the above example, it returns: – – will be an object with camelCased keys and function values corresponding to your state transitions.
  • For each transition, an action creator is created which will automatically fill in the correct action type, and pass through to the state.
  • The example fetch state machine will produce the following : – – is a normal Redux reducer function that takes the current state and an action object, and returns the new state.

redux-dsm – Declarative state machines for Redux: Reduce your async-state boilerplate.
Continue reading “redux-dsm is an easier way to handle async state. v3.0.0 has simplified state graphs. Yay! #reactjs #redux”

React Lifecycle, Quickly by the Method – Gabriel Kunkel – Medium

React Lifecycle, Quickly by the Method  #javascript #react #reactjs

  • React Lifecycle, Quickly by the MethodThese methods aren’t perfectly desirable to use, but they’re a way of exerting more control over the situation when the rest of the world just doesn’t want to cooperate with React.componentWillMount: Use for connecting to API’s on root components or containers.
  • componentDidMount: Load your data and do anything you need to do to a component.
  • After a parent component did some value changing.
  • This is the place to change outside DOM things in respect to changes that are linked up to the values tracked by react.
  • If you’re going to kill your component, this is the place where you clean-up everything that react won’t clean up on its own, including network requests, event listeners, and a canvas box.The whole cycle with methods.

These methods aren’t perfectly desirable to use, but they’re a way of exerting more control over the situation when the rest of the world just doesn’t want to cooperate with React.
Continue reading “React Lifecycle, Quickly by the Method – Gabriel Kunkel – Medium”