A Look Back at Semester 1

Welcome to Semester 2! As everybody gets back their groove and enters another exciting period of learning, it’s worth having a look back to see what we did as a community over the course of last…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Week 5 Learning Front End JavaScript

What is Redux?

Redux is a a centralized state management solution for JavaScript view libraries (i.e. Angular, React). It was designed to have a simple interface to provide and consume state, and to create actions to update it. Built using functional programming practices, Redux uses reducer functions to combine current state with an action to produce a new state. The signature is as follows:

store holds the state of your application. Any state that needs to be accessed and/or changed by any component in your application should most likely be held in the store. It has four methods:

The only way to change state in Redux is to dispatch an action via the store.dispatch() method. Here’s a step-by-step process:

A presentational component is generally concerned with generating markup to be rendered, i.e. “how things look.” A container component is concerned with “how things work.” It may manage state, provide data and behavior for nested presentational components. It’s like the “backend” of the frontend, so to speak.

A callback function to run after setState() is finished and the component is re-rendered. Can be helpful to provide simple followup to setState() calls, but for important followup, use another lifecycle method like componentDidUpdate().

Popular frameworks/libraries are popular for good reason. They take a crucial part of development and, if executed well, provide an elegant abstraction via APIs to offer powerful functionality without the hassle. And since they make normally tedious and technical things simpler, they typically have significant documentation to explain how to interact with their API.

The benefits of using, say, React for building dynamic frontends, Formik for building declarative forms, and NodeMailer for building a “dead-simple” emailer for your Node backend, are undeniable. But they aren’t without their drawbacks.

When you choose to use someone else’s codebase to build your own, you are depending on their codebase to be safe to use, stable, and up-to-date. Things can get really bad when one of your major dependencies goes stale, or worse, when its dependencies are out of date! I had this happen to me when I was trying to implement a small authentication package into a project during my backend JS course. Lots of time wasted…

Add a comment

Related posts:

The Story of Viola.AI

The story of Viola.AI starts 10years ago since the formation of its parent group Lunch Actually Group of Singapore. The dream of providing love and dating solutions to many single hearts had come up…

Should You Do Your Own Bathroom Remodel or Hire a Professional Bathroom Remodel Atlanta Firm?

One of the quintessential questions many homeowners ask is whether they can save on their bathroom renovations by doing some tasks on their own, or let a professional handle all the task at the…

Reef Origin Story

When a new industry moves fast it is to some degree expected to be fragmented. This means that if you want to do a certain thing which has to cover multiple aspects, you have to connect the dots…