Comments (11)
The restriction that Client Components aren't allowed to import Server Components is the source of complexities.
Do you mean import or render?
from rfcs.
I think you may be conflating Server-Side Rendering (SSR) and Server Components. The former can render client components, the latter cannot. Either can import client components.
from rfcs.
Client Components [...] may not import Server Components
from rfcs.
@davidbarratt
Have look at https://github.com/josephsavona/rfcs/blob/server-components/text/0000-server-components.md#capabilities--constraints-of-server-and-client-components
Oh right, I'm sorry I read what you wrote backwards. Yes the RFC makes sense to me. A client component couldn't import a server compoment because a server component could import Node's fs
module (as an example). If that is the case, then how would you expect the client to handle that import?
from rfcs.
Let me elaborate with what I mean with:
- The webpack react plugin removes the server component source code from the client-side bundle.
Concretely the webpack react plugin would replace the entire source code of a Server Component with the client-side mechanism that calls the /_react/render
endpoint. (More precisely with a call to that mechanism with as argument the ID of the Server Component.)
from rfcs.
Isn't that what shared components are? Basically the io
libraries have both a server-side and client-side mechanism within them.
from rfcs.
@brillout Thanks for taking the time to share your thoughts. I’d like to reply, but we’d like to keep the discussion about Server Components focused in a single place. Could you please move this post to a comment on the main RFC? That way people can find the answer more easily wo following two separate threads. Thanks!
from rfcs.
@josephsavona done. I'm super looking forward to read your reply!
from rfcs.
A central piece of the proposal is
Once the virtual dom computing goes server-side it never goes back client-side.
For that, the server should be able to compute the virtual dom of all components, including the Client Components. The current design prohibits Client Components from running/rendering in the server.
Shared Components are not the solution either as they are prohabited to have state and side-effects.
from rfcs.
For that, the server should be able to compute the virtual dom of all components, including the Client Components. The current design prohibits Client Components from running/rendering in the server.
That is Server Side Rendering (SSR). If the client has already loaded the application, why would it need to render on the server? That wouldn't be effecient.
Shared Components are not the solution either as they are prohabited to have state and side-effects.
Right because you can't have state nor side-effects on the server...
from rfcs.
Responded in #188 (comment)
from rfcs.
Related Issues (20)
- onScroll event propagation HOT 5
- [Feature Request]: distinguish "what" and "when" dependencies in useEffect HOT 2
- [Feature Request] Return ref rather than forwardRef HOT 1
- the ability to check if something is function or class or an arrow function HOT 5
- npx-create-react-app creating a folder tempnodejsnpm HOT 2
- [Feature Request] Can we do some Static Analysis for diff with babel ? HOT 6
- Improving the RFC workflow process HOT 18
- useIf: Conditional hooks HOT 6
- Is useReducer an overengineering? HOT 10
- Improve profiling react applications HOT 1
- Introduce GUI tooling to speed up web application development HOT 1
- psql: could not connect to server: No such file or directory HOT 1
- [Question] The new JSX transform HOT 1
- [Feature Request]: Add array of updated deps indices to `useEffect` hooks arg HOT 1
- [Feature Request]: React Hooks `Equality` **AKA:** `[isEqual]` Callback HOT 3
- Functional Attribute/Prop Node HOT 2
- [Feature Request][eslint-plugin-react-hooks] no-ref-checks, display error when using useRef's return value as condition HOT 1
- [Feature Request]: useStateRef HOT 5
- Typo: 'exiting' might be 'existing' HOT 2
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 rfcs.