make sliders work!

This commit is contained in:
Felix Roos 2023-10-01 00:24:31 +02:00
parent b36cee93f7
commit 062d926900
4 changed files with 95 additions and 87 deletions

View file

@ -0,0 +1,13 @@
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 };
}