Refactor and rename lambda in partial

This commit is contained in:
Sam Nolan 2022-05-02 21:05:59 +00:00
parent 5fc829efc9
commit 0d14216e9f

View File

@ -166,7 +166,7 @@ export let SquigglePartial: React.FC<SquigglePartialProps> = ({
let [expression, setExpression] = React.useState(initialSquiggleString); let [expression, setExpression] = React.useState(initialSquiggleString);
let [error, setError] = React.useState<string | null>(null); let [error, setError] = React.useState<string | null>(null);
React.useEffect(() => { let runSquiggleAndUpdateBindings = () => {
let squiggleResult = runPartial( let squiggleResult = runPartial(
expression, expression,
bindings, bindings,
@ -179,7 +179,9 @@ export let SquigglePartial: React.FC<SquigglePartialProps> = ({
} else { } else {
setError(errorValueToString(squiggleResult.value)); setError(errorValueToString(squiggleResult.value));
} }
}, [expression]); };
React.useEffect(runSquiggleAndUpdateBindings, [expression]);
return ( return (
<div> <div>