Giter Club home page Giter Club logo

Comments (8)

zynth666 avatar zynth666 commented on May 10, 2024 4

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.

joshuaellis avatar joshuaellis commented on May 10, 2024 1

🧠 @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.

joshuaellis avatar joshuaellis commented on May 10, 2024

Let me guess, it can't be used as an RSC because it uses React.Context?

from blocks-react-renderer.

zynth666 avatar zynth666 commented on May 10, 2024

You're goddamn right :D
image

from blocks-react-renderer.

remidej avatar remidej commented on May 10, 2024

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.

joshuaellis avatar joshuaellis commented on May 10, 2024

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.

remidej avatar remidej commented on May 10, 2024

@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.

joshuaellis avatar joshuaellis commented on May 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.