📜  React Context API - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:20.334000             🧑  作者: Mango

代码示例1
import React, { useState } from 'react'

const GlobalStateContext = React.createContext({ })

export const GlobalStateProvider = ({ children }) => {
    const [config, setConfig] = useState({
        projectInfo: ''
    })
    const [projectFile, setProjectFile] = useState('./test.cpp')
    const [executionState, setExecutionState] = useState("NoProject")

    return (
        
            {children}
        
    )
}

export default GlobalStateContext