({ children })
| 6 | |
| 7 | |
| 8 | export const WidgetContextProvider = ({ children }) => { |
| 9 | |
| 10 | const [activeWidget, setActiveWidget] = useState(null) |
| 11 | const [widgets, setWidgets] = useState([]) // stores the mapping to widgetRefs, stores id and WidgetType, later used for rendering [{id: , widgetType: WidgetClass, children: [], parent: "", initialData: {}}] |
| 12 | |
| 13 | // don't useState here because the refs are changing often |
| 14 | const widgetRefs = useRef({}) // stores the actual refs to the widgets inside the canvas {id: ref, id2, ref2...} |
| 15 | |
| 16 | |
| 17 | return ( |
| 18 | <WidgetContext.Provider value={{ widgets, setWidgets, widgetRefs, |
| 19 | activeWidget, setActiveWidget }}> |
| 20 | {children} |
| 21 | </WidgetContext.Provider> |
| 22 | ) |
| 23 | } |
nothing calls this directly
no outgoing calls
no test coverage detected