Skip to content

Commit 22e348e

Browse files
authored
Merge pull request #380 from moshie/fix-default-props
Remove Default props
2 parents 8efde89 + de346d7 commit 22e348e

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

.changeset/popular-pumas-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-live": patch
3+
---
4+
5+
fix default props

packages/react-live/src/components/Editor/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type Props = {
1515
};
1616

1717
const CodeEditor = (props: Props) => {
18+
const { tabMode = "indentation" } = props;
1819
const editorRef = useRef(null);
1920
const [code, setCode] = useState(props.code || "");
2021
const { theme } = props;
@@ -25,7 +26,7 @@ const CodeEditor = (props: Props) => {
2526

2627
useEditable(editorRef, (text) => setCode(text.slice(0, -1)), {
2728
disabled: props.disabled,
28-
indentation: props.tabMode === "indentation" ? 2 : undefined,
29+
indentation: tabMode === "indentation" ? 2 : undefined,
2930
});
3031

3132
useEffect(() => {
@@ -81,8 +82,4 @@ const CodeEditor = (props: Props) => {
8182
);
8283
};
8384

84-
CodeEditor.defaultProps = {
85-
tabMode: "indentation",
86-
} as Pick<Props, "tabMode">;
87-
8885
export default CodeEditor;

0 commit comments

Comments
 (0)