We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0156fdb + 8b2c893 commit a988388Copy full SHA for a988388
1 file changed
packages/react-live/src/components/Editor/index.tsx
@@ -24,16 +24,21 @@ const CodeEditor = (props: Props) => {
24
setCode(props.code);
25
}, [props.code]);
26
27
- useEditable(editorRef, (text) => setCode(text.slice(0, -1)), {
28
- disabled: props.disabled,
29
- indentation: tabMode === "indentation" ? 2 : undefined,
30
- });
+ useEditable(
+ editorRef,
+ (text) => {
+ const t = text.slice(0, -1);
31
+ setCode(t);
32
- useEffect(() => {
33
- if (props.onChange) {
34
- props.onChange(code);
+ if (props.onChange) {
+ props.onChange(t);
35
+ }
36
+ },
37
+ {
38
+ disabled: props.disabled,
39
+ indentation: tabMode === "indentation" ? 2 : undefined,
40
}
- }, [code]);
41
+ );
42
43
return (
44
<div className={props.className} style={props.style}>
0 commit comments