React.FC equivalent for RSC

Is there a "React.FC" equivalent for React Server Components?
5 Replies
Neto
Neto2y ago
by default every react components is a server component React.FC is for the sake of typescript
domi?
domi?OP2y ago
yes, that's what I'm looking for so that I accidentally don't return something that's not jsx in a server component
Neto
Neto2y ago
Just using FC is enough As long you don't need something that would happen only on client, like state or window related It's fine to return in a server component
domi?
domi?OP2y ago
const ExampleRSC: React.FC = async () => {};
const ExampleRSC: React.FC = async () => {};
That's what I did originally, but I get this type error: Type '() => Promise<void>' is not assignable to type 'FC<{}>' It doesn't accept it if it return value is a promise
Neto
Neto2y ago
It's fixed on the new typescript release Next does accept But typescript complains
Want results from more Discord servers?
Add your server