Do I need to make a new file for each client component used by a server component
Answered
Shiba Inu posted this in #help-forum
Shiba InuOP
Basically what it says above, I have a client 'button' and a 'button list' server component. I wanted them in the same file if possible but i didnt if you could put "use client" under the specific button component function or if itd have to be a new file with use client at the top
Answered by joulev
yes you need a new file. at least you need one file for all your client components and one file for all your server components because you cannot declare both server components and client components in the same file
3 Replies
@Shiba Inu Basically what it says above, I have a client 'button' and a 'button list' server component. I wanted them in the same file if possible but i didnt if you could put "use client" under the specific button component function or if itd have to be a new file with use client at the top
yes you need a new file. at least you need one file for all your client components and one file for all your server components because you cannot declare both server components and client components in the same file
Answer
Shiba InuOP
ah oki, i thought itd be like that but worth checking
ty vm <3