strapi / blocks-react-renderer

A React renderer for the Strapi's Blocks rich text editor
Other
107 stars 15 forks source link

fix: react server component support #16

Closed remidej closed 6 months ago

remidej commented 6 months ago

What does it do?

Why is it needed?

To prevent React from running these components on the server, as they require client-only APIs. See #10

I first tried to offer proper server component support by removing the use of React context. It made the DX quite a bit worse with lots of prop drilling. But it also wasn't enough as we're also using useRef, so I chose to go client-only instead.

How to test it?

Create a Next app with the app router, import and use the renderer, it shouldn't throw an error anymore.

Related issue(s)/PR(s)

Fixes #10