Skip to content

Commit

Permalink
Remove useRef usage (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodPassiveMan authored Mar 6, 2024
1 parent a170d31 commit 92a53b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Markdown.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, Fragment, useRef } from 'react';
import { createElement, Fragment } from 'react';
import { Marked, MarkedOptions } from 'marked';

import ReactParser from './ReactParser';
Expand Down Expand Up @@ -33,11 +33,13 @@ const defaultProps = {
renderer: undefined,
};

const markedInstance = new Marked();

const Markdown = (props: MarkdownProps) => {
validateComponentProps(props);

const options = { ...defaultProps, ...props };
const { current: marked } = useRef<Marked>(options.instance ?? new Marked());
const marked = options.instance ?? markedInstance;

// lexer options
const lexerOptions = {
Expand Down

0 comments on commit 92a53b4

Please sign in to comment.