Very Important Javascript functions. You must know these functions in order to call yourself a JS Developer.
- JSON.parse
- Stringify
- Convert Object to an array
- Object Keys
- Object Values
- Object Assign
- Array map, reduce, indexOf
LifeCycle Methods in Class components
1) We don't need these files in our to react app
The state object is where you store property values that belong to the component.
When the state object changes, the component re-renders.
What is a hook in React js?
Examples are
Hooks are a special function that allows you to connect with react features.
Hooks don’t work inside classes. But you can use them instead of writing class.
React provides a few built-in Hooks like useState, useEffect.
We can also create our own hook to reuse stateful behavior between different components.
Hooks let you use state & other react features without writing a class.
useState is a hook that lets you add `React state` to the function component. previously you can only use state with class components.
useState is a new way to use the exact same capabilities in a `function` that this.state provides in a `class`.import React, {useState} from 'react';
const Basicform = () => {
We are going to create 2 components
class component
functional component
Ref: https://www.geeksforgeeks.org/differences-between-functional-components-and-class-components-in-react
ref2: https://www.youtube.com/watch?v=uGgPINlKqBs
You can pass props in both components. But in functional components, you have to use the `props` keyword & in-class component you automatically have the refernece