mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-13 14:48:32 +00:00
14 lines
389 B
JavaScript
14 lines
389 B
JavaScript
import { useEffect, useState } from 'react';
|
|
import { updateWidgets } from '@strudel/codemirror';
|
|
|
|
// i know this is ugly.. in the future, repl needs to run without react
|
|
export function useWidgets(view) {
|
|
const [widgets, setWidgets] = useState([]);
|
|
useEffect(() => {
|
|
if (view) {
|
|
updateWidgets(view, widgets);
|
|
}
|
|
}, [view, widgets]);
|
|
return { widgets, setWidgets };
|
|
}
|