You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As so far , only next.js and react original js support react server componet.
In next.js developer is to being requested to use “use client” to idenfy the react client component , and all of the other js are default to react server component.
In the community find the another way to identity component is to change its file suffix
'.server.js' means this is a server component
'.client.js' means its a client component
So I want to know what is the react official identifier for server component and client component in future?
The text was updated successfully, but these errors were encountered:
.client.js and .server.js was the convention that was proposed originally but later changed to using 'use client' and 'use server' directives instead in reactjs/rfcs#227.
Such an approach violates the principle of separation of concerns, as component files should be independent of where they are used (on the server or client). Instead, it's better to strive for creating reusable components that can work seamlessly both on the server and client without modifications.
Some components only make sense on the server (e.g. accessing the file system) and need server directives. Most components can be used as both and don't need directives. The linked RFCs go into more detail.
If there are issues with the current approach, I recommend filing a new issue outlining the problems in detail with some examples. Closing this since the original question was answered.
As so far , only next.js and react original js support react server componet.
In next.js developer is to being requested to use “use client” to idenfy the react client component , and all of the other js are default to react server component.
In the community find the another way to identity component is to change its file suffix
'.server.js' means this is a server component
'.client.js' means its a client component
So I want to know what is the react official identifier for server component and client component in future?
The text was updated successfully, but these errors were encountered: