kentcdodds / mdx-bundler

🦤 Give me MDX/TSX strings and I'll give you back a component you can render. Supports imports!
MIT License
1.78k stars 75 forks source link

Broken code in a README code snippet #147

Open ngfelixl opened 2 years ago

ngfelixl commented 2 years ago

Problem description:

In the README.md there is the following code snippet for ssr:

function MDXPage({code}: {code: string}) {
  const Component = React.useMemo(
    () => getMDXComponent(result.code, {myLeftPad: leftPad}),
    [result.code, leftPad],
  )
  // [...]
}

Suggested solution:

It should either be:

function MDXPage({code}: {code: string}) {
  const Component = React.useMemo(
    () => getMDXComponent(code, {myLeftPad: leftPad}),
    [code, leftPad],
  )
  // [...]
}

Or result: {code: string} instead of {code}: {code: string}.

Thanks for making awesome stuff like remix, open-source kentcdodds.com and all the other work.