skip to Main Content

Reactjs – How To Use useContext react

import React from 'react' import ReactDOM from 'react-dom' import { useContext } from 'react' const konteks = React.createContext(null); function components(){ return( <konteks.Provider value="hello world"> <MyComponent /> </konteks.Provider> ); } function MyComponent(){ const getcontext = useContext(konteks); return( <div>{getcontext}</div> ); } const…

VIEW QUESTION

Reactjs – useState Hook react

in useState hook when the setState is called it will initializes the state with a new value i have the example of code below : import React from 'react' import ReactDOM from 'react-dom/client' import { useState } from 'react' function…

VIEW QUESTION
Back To Top
Search