State Management with Redux & MobX

Frontend Masters State Management with Redux & MobX 10/2020

[Frontend Masters] State Management with Redux & MobX​


[Frontend Masters] State Management with Redux & MobX




State Management with Redux & MobX - On this course, you’ll learn best practices for structuring your data and the best way to hold your utility quick and nimble as your codebase grows. You’ll get your palms on a number of options for managing state in giant React purposes together with Redux, Redux Thunk, Redux Observables and MobX.

Introduction​

  • State Management with Redux & MobX Introduction Steve Kinney introduces the course on Redux & MobX by giving an outline of what the course will cowl and argues for the worth in enhancing the state administration of an utility.
  • Pure & Impure Features Steve explains the which means of pure and impure capabilities by way of a perform's unintended effects, and relates this to the mutation of objects and arrays in JavaScript.
  • Copy As a substitute of Mutate Steve discusses strategies of acquiring immutable knowledge constructions, together with libraries, object strategies, and array strategies.
  • Single State Retailer & Reducers Steve introduces the one state retailer in Redux, a JavaScript object which incorporates the applying's state and is modifiable by way of the utilization of functionally pure reducers.

Redux Functions​

  • State Management with Redux & MobX Redux Features Overview Steve provides an outline of Redux capabilities after which provides an indication of utilizing the compose perform to mix capabilities collectively.
  • reducer & createStore Steve writes code to show utilization of createStore by passing it a primary reducer. Then, the keys on the shop are considered and a primary occasion is handed by way of the dispatch technique.
  • Retailer dispatch & subscribe Steve demonstrates utilization of the dispatch and subscribe strategies through the use of dispatch to go occasions to the shop's reducer perform, and subscribe to view the modified state after every occasion dispatch. An instance reducer is rewritten to take away impurities.
  • combineReducers Steve explains the aim of combineReducers, and describes the way it permits breaking apart performance into manageable items by pairing reducers with the state object.
  • bindActionCreators Steve makes use of bindActionCreator to bind a perform that creates "add" actions to the shop's dispatch technique to scale back pointless complexity when dispatching actions to the shop.
  • Middleware in Redux Steve discusses what middleware is and the way an utility can profit from having it. Then, an instance is given of how analytics middleware was utilized to resolve an actual world state of affairs.

Redux & React​

  • State Management with Redux & MobX Create Redux Store Steve creates the Redux implementation for a supplied counter utility utilizing the react-redux library, addresses criticisms with Redux, and discusses methods to stop errors when utilizing strings in an utility.
  • Join Redux to React Steve demonstrates the best way to hook up the Redux retailer with React parts through the use of a Supplier part and the join technique together with mapping capabilities to map state and dispatch to properties.
  • Redux Reducer Train & Resolution College students are instructed to implement the decrement performance of the counter, after which Steve reside codes the answer to the train.
  • Refactoring an App to Use Redux Steve breaks down components in deciding whether or not or to not use Redux in an utility and introduces the part on normalizing knowledge.
  • Implementing a Kanban Board Steve introduces the following course venture, making a Redux implementation of a kanban board. The Normalizr library, which will likely be used all through the venture, can be launched.
  • State Retailer Schema Steve makes use of Normalizr to create the state retailer schema for the kanban board, describing the best way to remodel the information utilizing the schema and normalize capabilities in a method that the majority successfully permits entry to customers and playing cards.
  • Wiring State Retailer to the App Steve wires the state retailer to the applying by passing the shop into React, creating a listing reducer, making a mixed reducer which is able to comprise branches for lists, customers, and playing cards, and including react-redux Supplier tags.
  • Redux DevTools Steve makes use of the Redux Dev Instruments makes use of extension to view info particular to Redux, together with actions, the present state, and a timeline of occasions that occurred on the web page.
  • Utilizing State Retailer in Elements Steve modifies the kanban board to incorporate the Redux state retailer in its parts by creating containers for the group of lists and the person lists, after which swaps the parts into the applying.
  • Wiring Redux to a React App Train College students are instructed to create a card reducer, hook it into the mix reducer perform, and swap out the cardboard part with the cardboard container part.
  • Wiring Redux to a React App Resolution Steve reside codes the answer to the train.
  • Implementing Map Dispatch to Props Steve permits including playing cards utilizing the mapDispatchToProps perform, making a container for card creation, including it to the proper part, and permitting motion knowledge to movement by way of the applying.
  • Dealing with Dispatched Actions Steve handles the actions which might be flowing by way of the system, updating the state of the applying to mirror modifications by implementing modifications to the cardboard and record reducer capabilities in Redux.
  • Updating Nested State Steve makes use of the FP Lodash set perform to create a helper that abstracts away object creation when including a card to a listing.
  • Motion Creator Helpers Steve refactors code to make altering the state extra readable, after which creates an motion creator helper for the cardboard creation container benefiting from the react-redux characteristic that robotically binds motion creators with dispatch.

Redux Libraries​

  • State Management with Redux & MobX State Store Selectors with Reselect Steve makes use of the Reselect library to chop down on the variety of instances an motion to retrieve an object's values is unnecessarily repeated.
  • Reselect Efficiency Steve provides an actual world instance of a efficiency problem that might happen when utilizing the Reselect library.
  • Redux Thunk Steve introduces Redux Thunk by explaining the way it permits dispatching capabilities that dispatch an motion at a later time.
  • Redux Thunk Setup Steve demonstrates the best way to use Redux Thunk so as to add asynchronous code to a Redux retailer by establishing code to fetch from an API.
  • Redux Thunk: Dispatching Actions Steve writes code to dispatch the motion and replace the web page with the response from the asynchronous fetch operation and summarizes the timeline of occasions within the utility.
  • Redux Observable Steve introduces Redux Observable, which binds Redux to RxJS. Epics, a technique to remodel motion knowledge mid switch, are launched by way of illustrations.
  • Redux Observable Setup Steve units up Redux Observables by making a root epic and setting the reducers listening and the epics to hear.
  • Redux Observable: Mapping Actions Steve hooks the items of the applying collectively by taking the end result, piping it by way of a sequence of capabilities, and mapping the response into the specified motion. The choice course of for utilizing Redux Observables and debugging utilizing faucet are additionally mentioned.
  • Redux Observable: Cancelling Requests Steve demonstrates the best way to cancel API requests when a more recent request comes by way of earlier than an older request has completed, stopping flashes of middleman content material throughout the utility. A query is fielded about helpful capabilities in RxJS.

MobX​

  • State Management with Redux & MobX MobX Decorators Steve introduces MobX by discussing computed properties, getters and setters, decorators, and the advantages and disadvantages of utilizing decorators in an utility.
  • Pure MobX Demo Steve makes use of MobX with vanilla JavaScript, in isolation of React, to show how MobX can be utilized to govern the DOM because the person causes occasions that change the state.
  • MobX Ideas Steve analyzes the key ideas in MobX: observable state, actions, derivations, computed properties, and reactions. A use case for the MobX characteristic of cached variations of computed properties is talked about.
  • MobX in React Steve explains utilization of MobX in React, together with adorning a React class with observer to set off React to rerender on change and the way MobX permits for avoiding the shouldComponentUpdate perform and prop drilling.
  • Checklist Mannequin MobX Retailer Steve describes the course venture on MobX, which is to create a packing record, and begins to wire up MobX by constructing a number of computed properties on high of one another throughout the record mannequin retailer.
  • Merchandise Mannequin MobX Retailer Steve writes the code for the merchandise mannequin retailer and provides additional clarification in regards to the objective of motion.certain decorator.
  • Add & Take away from the MobX Retailer Steve constructs the add and take away strategies for the MobX retailer, giving a high-level description of the state administration that's occurring throughout the utility.
  • Wiring MobX to the React App Steve modifies the applying code to attach the MobX merchandise and record shops to the React utility, creating parts for the unpacked and packed lists after which wiring them in.
  • Sending Information from React into MobX Steve writes code to inject knowledge from the MobX retailer into React parts to deal with occasions coming in by way of enter fields.

Wrapping Up​

  • State Management with Redux & MobX MobX vs Redux Steve differentiates MobX and Redux by breaking down their respective structures, after which explains the best way to method an issue based on these structures.
  • Wrapping Up & Q&A Steve concludes the course on Redux and MobX by giving recommendation about the best way to arrive at a call about the best way to structure a code base. Then, questions are fielded about normalization and implementing undo/redo.
Author
PIRATE
Downloads
17
Views
35
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from PIRATE

AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock