Skip to content

Commit

Permalink
🐛 fix: fixed memo markdown components was not show
Browse files Browse the repository at this point in the history
  • Loading branch information
ONLY-yours committed Dec 26, 2023
1 parent 739e915 commit 406359c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ export interface MarkdownProps {
remarkPlugins?: PluggableList;
}

const MemoHr = memo(() => <Divider style={{ marginBottom: '1em', marginTop: 0 }} />);
const MemoDetails = memo(() => <Collapse style={{ marginBottom: '1em' }} />);
const MemoAlink = memo(() => <Typography.Link />);
const MemoImage = memo(() => <img />);
const MemoHr = memo((props) => (
<Divider style={{ marginBottom: '1em', marginTop: 0 }} {...props} />
));
const MemoDetails = memo((props) => <Collapse style={{ marginBottom: '1em' }} {...props} />);
const MemoImage = memo((props) => <img {...props} />);
const MemoAlink = memo((props) => <Typography.Link {...props} />);

const Markdown = memo<MarkdownProps>(
({
Expand All @@ -38,9 +40,9 @@ const Markdown = memo<MarkdownProps>(
}) => {
const { styles } = useStyles();
const components: any = {
a: MemoAlink,
details: MemoDetails,
hr: MemoHr,
a: MemoAlink,
img: MemoImage,
pre: Code,
};
Expand Down

0 comments on commit 406359c

Please sign in to comment.