Skip to content

Commit

Permalink
Merge pull request #380 from moshie/fix-default-props
Browse files Browse the repository at this point in the history
Remove Default props
  • Loading branch information
keithluchtel authored Feb 2, 2024
2 parents 8efde89 + de346d7 commit 22e348e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-pumas-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-live": patch
---

fix default props
7 changes: 2 additions & 5 deletions packages/react-live/src/components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type Props = {
};

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

useEditable(editorRef, (text) => setCode(text.slice(0, -1)), {
disabled: props.disabled,
indentation: props.tabMode === "indentation" ? 2 : undefined,
indentation: tabMode === "indentation" ? 2 : undefined,
});

useEffect(() => {
Expand Down Expand Up @@ -81,8 +82,4 @@ const CodeEditor = (props: Props) => {
);
};

CodeEditor.defaultProps = {
tabMode: "indentation",
} as Pick<Props, "tabMode">;

export default CodeEditor;

0 comments on commit 22e348e

Please sign in to comment.