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 function SYNTAX 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

Leave a comment

Related Posts

Machine learning models

“No machine learning model is valuable, unless it’s deployed to production.” – Luigi Patruno   The machine learning models are being used to achieve many difficult

Read More »
Product Manager Intern

Do you have a passionate dedication to your craft and a desire to work with peers that inspire you on a daily basis? Do you

Read More »
Content Writer Intern

Do you have a passion for writing and an innovative ability to create successful marketing campaigns and aid in creating company growth? If so, Ismile Technology is

Read More »

Contact us for a quote, help, or to join the team.

email

service@iSmileTechnologies.com

phone

(732) 347-6245

About Us

iSmile Technologies is a global technology services company.

service@iSmileTechnologies.com
(732) 347-6245

USA

+1 (732) 347-6245
241 Jonathan Way
Bolingbrook, IL 60490

INDIA

2-3-285, Secunderabad Hyderabad 500003

CANADA

3190 Stocksbridge Ave
Oakville, ON L6M 0A7