Skip to content

Commit

Permalink
Remove deprecated defaultProps (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyi12358 authored Jul 3, 2023
1 parent 4646dde commit 31ae07d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ const validateComponentProps = (props: MarkdownProps) => {
}
};

const Markdown = (props: MarkdownProps) => {
const defaultProps = {
isInline: false,
breaks: false,
gfm: true,
baseURL: undefined,
openLinksInNewTab: true,
langPrefix: 'language-',
renderer: undefined,
};

const Markdown = (incomingProps: MarkdownProps) => {
const props = { ...defaultProps, ...incomingProps };
validateComponentProps(props);

// lexer options
Expand Down Expand Up @@ -56,14 +67,4 @@ const Markdown = (props: MarkdownProps) => {
return createElement(Fragment, null, children);
};

Markdown.defaultProps = {
isInline: false,
breaks: false,
gfm: true,
baseURL: undefined,
openLinksInNewTab: true,
langPrefix: 'language-',
renderer: undefined,
};

export default Markdown;

0 comments on commit 31ae07d

Please sign in to comment.