Table of Contents

React Hooks

What is HR Automation?

It is a feature introduced to play with states in functional components as previously it was just being used with class components only.Hooks are the functions which “hook into” React state and life cycle features from function components.RULES FOR USING HOOKS:(1)- Only call hooks at top level(2)- Only call hooks from react functionSYNTAX INVOLVED WITH USING STATE IN HOOKS:

 

import React, {useState} from ‘React;

  1. importReact, { useState } from ‘react’;  
  2.  
  3. function CountApp() {  
  4. // Declare a new state variable, which we’ll call “count”  
  5. const [count, setCount] = useState(0);  
  6.  
  7. return (  
  8. <div>  
  9. <p>You clicked {count} times</p>  
  10. <button onClick={() => setCount(count + 1)}>  
  11. Click me  
  12. </button>  
  13. </div>  
  14. );  
  15. }  
  16. export defaultCountApp;

BASIC HOOKS:

(1)- useState()

(2)- useEffect()

(3)- useContext()

Sana Eram

Data Scientist Intern

Liked what you read !

Please leave a Feedback

Leave a Reply

Your email address will not be published. Required fields are marked *

Join the sustainability movement

Is your carbon footprint leaving a heavy mark? Learn how to lighten it! ➡️

Register Now

Calculate Your DataOps ROI with Ease!

Simplify your decision-making process with the DataOps ROI Calculator, optimize your data management and analytics capabilities.

Calculator ROI Now!

Related articles you may would like to read

The Transformative Power of Artificial Intelligence in Healthcare
How To Setup An AI Center of Excellence (COE) With Use Cases And Process 
Proposals

Know the specific resource requirement for completing a specific project with us.

Blog

Keep yourself updated with the latest updates about Cloud technology, our latest offerings, security trends and much more.

Webinar

Gain insights into latest aspects of cloud productivity, security, advanced technologies and more via our Virtual events.

ISmile Technologies delivers business-specific Cloud Solutions and Managed IT Services across all major platforms maximizing your competitive advantage at an unparalleled value.

Request a Consultation