Hooks mainly used to provide state, lifecycle methods and all other features in functional component that we generally get in a class component. But also makes it easier to apply.
Where to use
Hooks are mainly used in react functional components. Because functional components are stateless and hooks provide us facility to use most of the react features in them.
Why we prefer hooks
To understand this we should first understand why we use functional component because ultimately they are used inside functional components.
benefits of using functional component
The spread operator is awesome. It can do so much — it’s efficient, readable, and can save a whole load of mess. I have used this many times.
So, What Actually is the Spread Operator?
Spread Operator represented by Three dots:
Three very powerful dots, that allow you to expand arrays or iterable objects in places…
CSS selectors are the ways by which we select the HTML elements and style them. These HTML elements may be either single or in groups, either adjacent or in different places.
These selectors are basically divided into 4 categories:
2. Combinators Selectors
Simple Selectors: It selects html elements based on the id, class and tag.
#id selector styles the element based on the id attribute provided to HTML elements.
e.g. #firstname Selects the element with id=”firstname”
.class selector selects elements based on the class attribute provided to HTML elements.
UI Developer @HCL Technologies