mdx-bundler icon indicating copy to clipboard operation
mdx-bundler copied to clipboard

Question: Warning: Do not call Hooks inside useEffect

Open shaun-fitzgibbon opened this issue 3 years ago • 2 comments

  • mdx-bundler version: 8.0.1
  • node version: 17.4.0
  • yarn version: 1.22.15

Relevant code or config

const Post = ({ code, frontmatter }) => {
  const Component = useMemo(() => getMDXComponent(code), [code])

  return (
    <div className={styles.container}>
      <h2>{frontmatter.title}</h2>
      <Component />
    </div>
  )
}

What happened: When using mdx-bundler and styled components while Importing a custom component into mdx file that also imports a second custom component warnings are displayed in the console

is there a better way go about this to stop the warnings in the console ?

Screenshot 2022-02-08 at 15 24 03

shaun-fitzgibbon avatar Feb 08 '22 13:02 shaun-fitzgibbon

I'm getting the same, unsure how to solve it.

splunkmoody avatar Feb 28 '22 01:02 splunkmoody

I think this a duplicate of issue (https://github.com/kentcdodds/mdx-bundler/issues/100)

Revilotom avatar Mar 03 '22 13:03 Revilotom