Comments (8)
This is my current workaround for anyone wondering.
"use client";
import { BlocksRenderer } from "@strapi/blocks-react-renderer";
type BlocksRendererProps = Parameters<typeof BlocksRenderer>[0];
export default function RichText(props: BlocksRendererProps) {
return <BlocksRenderer content={props.content} blocks={props.blocks} />;
}
from blocks-react-renderer.
🧠 @remidej we might need to add a plugin to pack-up
because it might strip out the directive. I'm not sure and this would need to be tested before publishing stable 🌞
from blocks-react-renderer.
Let me guess, it can't be used as an RSC because it uses React.Context
?
from blocks-react-renderer.
from blocks-react-renderer.
This makes me wonder if we should remove the use of React context altogether. Prop drilling is annoying, but I think opting out of server components may be worse. Especially since rich text is probably mostly used in static pages, with a requirement to have good SEO etc.
from blocks-react-renderer.
This makes me wonder if we should remove the use of React context altogether. Prop drilling is annoying, but I think opting out of server components may be worse. Especially since rich text is probably mostly used in static pages, with a requirement to have good SEO etc.
Server components doesn't mean it's not server-side rendered @remidej
from blocks-react-renderer.
@joshuaellis you mean that it's not binary and you can do interleaving between server and client, right? But shouldn't we still try to have as much as possible on the server when possible? at least just to have less client side JS code?
from blocks-react-renderer.
Yeah pretty much, afaik you can still SSR context // state etc. and then it should be hydrated, I'm not sure if next forces you to use RSC to SSR though.
I think weigh up how long the refactoring would take and what it would look like — could composition replace the need for it? Is it us being "preemptive" of needs?
If it won't take long to remove the context then great. We can also probably get it added to this list once we're done – reactwg/server-components#6
from blocks-react-renderer.
Related Issues (8)
- [bug]: Paragraphs in blocks do not respect new lines HOT 8
- [bug]: Module '"@strapi/blocks-react-renderer"' has no exported member 'BlocksContent' HOT 6
- [bug]: Links seem to be nested into paragraphs or not being parsed HOT 7
- [feat]: Convert to react-native
- [feat]: Extract plain text from blocks HOT 1
- [feat]: Vanilla JS library HOT 1
- [feat]: The blocks-react-renderer npm package is used to render the content configured in the Rich text (Blocks) rich text edit box. Only the content has no format. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blocks-react-renderer.