Tag: controllers

React, also known as ReactJS, is an open source JavaScript library for building user interfaces, often for single-page applications or to add interactive views to existing web applications built in a variety of architectures.

The React project originated at Facebook; the open source project has a BSD license and a patent rights grant from Facebook.

One of the top reasons people cite as a reason to use React is actually controversial: JSX allows you to mix JavaScript and HTML in a single component, which is transformed into pure JavaScript as part of the build step.

It is just another way of building an MVC framework where the presentational components are the views and container the controllers.LifecycleThe lifecycle of a component are customizable and goes through different phases when the components are in a state of change.

A prop supports or keeps something in position whereas a state is a condition that is susceptible to change.Before I dive right into my final project, I need to figure out the proper structure of my application.

Graphically, this is the schema of a Redux app: – – Basically, Redux does the following: – – An OTP GenServer does the following: – – In short, we can use the same mental model for the client and server side.

We can dispatch events to Elixir, compute a new version state server side, propagate this state to redux, and our views will get updated automatically.

We have just implemented the thick red arrows: – – We will update the store with the state that comes from the server in two different situations.

With this, we have connected the server state with Redux state.

But, if you want to have state shared between different users, or we want to have pieces of the state in the server for other reasons, such as enforcing validation rules, we can use the same mental mode with Elixir GenServers.