Skip to main content

Mycontext

 // MyContext.js

import React, { createContext, useState, useContext } from 'react';


const MyContext = createContext();


export const MyProvider = ({ children }) => {

  const [myState, setMyState] = useState('Initial Value');


  const updateState = (newState) => {

    setMyState(newState);

  };


  return (

    <MyContext.Provider value={{ myState, updateState }}>

      {children}

    </MyContext.Provider>

  );

};


export const useMyContext = () => {

  return useContext(MyContext);

};


Comments

Popular posts from this blog

Delete put code

   <system.webServer>     <validation validateIntegratedModeConfiguration="false"/>     <modules runAllManagedModulesForAllRequests="true">         <remove name="WebDAVModule"/> <!-- ADD THIS -->     </modules>      <handlers>            <remove name="ExtensionlessUrlHandler-Integrated-4.0" />       <remove name="OPTIONSVerbHandler" />       <remove name="TRACEVerbHandler" />       <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />     </handlers></system.webServer>

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

  WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive). Solution   < appSettings > < add key = "ValidationSettings:UnobtrusiveValidationMode" value = "None" /> </ appSettings >