GithubHelp home page GithubHelp logo

Comments (1)

tom-sherman avatar tom-sherman commented on November 11, 2024 1

In the majority of cases (11/18) this pattern continues to work. See tables below.

Server execution context

eg. a Next.js page.tsx and any non-client imports

Shared <Icon> Client <Icon> Server <Icon>
Shared <ArrowIcon>
Client <ArrowIcon>
Server <ArrowIcon>

Client execution context

eg. a "use client" module or any imported imports

Shared <Icon> Client <Icon> Server <Icon>
Shared <ArrowIcon>
Client <ArrowIcon>
Server <ArrowIcon>

Commentary

  • If <Icon> is a shared component, the pattern works in all cases except when in a client context and the as prop is a server component. This doesn't work because you can't import and render a server component into a client context.
  • A server Icon always works in a server context but it can never work in a client context because of the same constraint
  • A client Icon can only work in a server context when the as prop is also a client component.
  • In a client context only, a client Icon can have a shared as prop

In my opinion there's nothing that React should do here. The pattern continues to work in the majority of cases, especially if Icon is a shared component.

from react.

Related Issues (20)

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.