-
Reproduction processhttps://codesandbox.io/p/sandbox/react-markdown-forked-h8w483
![]() How can I get onClick to work while streaming? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi A general tip: share code in code blocks, not screenshots. I see a couple of problems. Markdown cannot be streamed. The full document needs to be parsed before it can be rendered. If you render partial markdown documents, you may get unexpected results. Don’t define React components during render. This will make it impossible for React to diff the virtual dom and cause many redundant rerenders. You should move your Don’t use a |
Beta Was this translation helpful? Give feedback.
As @remcohaszing said, just move
components
outside, it will just works as as you expected.https://codesandbox.io/p/sandbox/react-markdown-forked-5rs49w