4 ms·
No one would actually use this in production code. It is a useful convention for examples so that you can tell you are in server or client code. Occasionally it
by singlow 11y ago
No one would actually use this in production code. It is a useful convention for examples so that you can tell you are in server or client code. Occasionally it might be useful in a function that only has a slight deviation in behavior on the server, although usually you would wrap that difference in a function that is implemented separately in client or server only libraries.
In application code you would put all server-only code in the server directory and that code is excluded from the client code, same for client only code. In plugins, you specify which files are included in the client and server explicitly.
- JustSomeNobody 11y agoI've seen enough code to know that if it's in an example, it's in production.