S
SolidJS13mo ago
dion

How do we determine what's client side code and what's serverside code

As the title say, i'm unsure how to seggregate my code, or the right way to think about this framework. Any resource would help indefinitely! Thanks!
1 Reply
lxsmnsyc
lxsmnsyc13mo ago
You have to make the distinction while writing the code or during runtime. For example:
import { isServer } from 'solid-js/web';

if (isServer) {
console.log('This is in server');
} else {
console.log('This is in client');
}
console.log('This is in both');
import { isServer } from 'solid-js/web';

if (isServer) {
console.log('This is in server');
} else {
console.log('This is in client');
}
console.log('This is in both');
Want results from more Discord servers?
Add your server