mirror of
https://github.com/guilhermewerner/tomasulo-simulator
synced 2025-06-15 05:14:20 +00:00
18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
import { createContext, useState } from 'react';
|
|
|
|
export const ProgramContext = createContext(null);
|
|
|
|
export const ProgramContextProvider = ({ children }) => {
|
|
const [program, setProgram] = useState({});
|
|
|
|
const updateProgram = (newObject) => {
|
|
setProgram(newObject);
|
|
};
|
|
|
|
return (
|
|
<ProgramContext.Provider value={{ program, updateProgram }}>
|
|
{children}
|
|
</ProgramContext.Provider>
|
|
);
|
|
};
|