state for context api of react

    0

    0

    The code imports Context from the ./noteContext directory, initializes State with a Props object, and returns an HTML string that includes a Context.provider element that references state.children, which is an array of objects.

    Library: react

    Shortcut: statecontext

    import Context from "./noteContext";
    
    const State = (props) => {
    
      const state = {
        "name" : "Sagar",
        "class" : '5b'
      }
    
      return(
        <Context.provider value={state}>
          {props.children}
        </Context.provider>
      )
    
    }
    
    export default State;
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.