Mern Stack
Mern Stack
STACK DEVELOPMENT
A R I H A R A S U D H A N
THE MERN STACK
A Stack is the various tiers or technologies.
MERN is a great web developing stack. It is
definitely a good choice for web application
projects.
Rendering JSX
Let’s render our JSX to the DOM. ReactDOM
offers a simple method to render React
elements to the DOM which looks like this:
ReactDOM.render(whatToBeRendered,
whereToBeRendered). Hmm… We have to
determine where to render. Let’s create a
division with an ID of here.
Now, the script element must have a type of
text/babel which is our transpiler discussed
earlier.
Stateful Components
A stateful component is a class component
that maintains its own internal state. State
consists of any data, that can change over
time.
A state can be created within the constructor.
This initializes the component with state
when it is created. The state must be set to a
JS object as below :
this.state = { }
State as Props
State can be passed as props. Consider a
component named College. It has a state of
two state members such as student and
clgname with the values of “Ariharasudhan”
and “Einstein College of Engineering”
respectively.
It renders the another component Student.
Besides, we have passed the clgname as
props to the Student component.
The output is,
Multiple State Values as Props
We can pass many state values as props as
shown below.
Output is,
Response :
Routing can be dynamic. For an instance,
let’s consider the following.