component
Answered
Ivory-billed Woodpecker posted this in #help-forum
Ivory-billed WoodpeckerOP
how can I create component, header????
Answered by B33fb0n3
then you need to create this component first. To create a component as seperate file, you can create a file like
Then import it in your
ComponentName.js and then paste this in your .js file: https://nextjs-forum.com/post/1266819757374705714#message-1266820028393586862Then import it in your
page.js like <ComponentName />88 Replies
@Ivory-billed Woodpecker how can I create component, header????
use this template (I am using it for all of my components):
In your case you want to change it a bit so it has the correct name
export default function ComponentName() {
return (
<>
<h1>ComponentName</h1>
</>
)
}In your case you want to change it a bit so it has the correct name
Ivory-billed WoodpeckerOP
yes xd but
where can I create component
I have src/app
page.js
thats all
then inside your
page.jsIvory-billed WoodpeckerOP
i dont know where can I create component
no
so go in your
page.js and copy past this: https://nextjs-forum.com/post/1266819757374705714#message-1266820028393586862Ivory-billed WoodpeckerOP
I need <Header />
I want use <Header> inside page
then you need to create this component first. To create a component as seperate file, you can create a file like
Then import it in your
ComponentName.js and then paste this in your .js file: https://nextjs-forum.com/post/1266819757374705714#message-1266820028393586862Then import it in your
page.js like <ComponentName />Answer
Ivory-billed WoodpeckerOP
where
should i create component
which folder
????
man simple question....
Inside your app folder
It seems like you are new in the whole web developement thing. In developement you can't just start by watching a youtube video or ask other people and follow every step the guy in the video does or someone said to you. That works, until you get an error. So start by learning the basics and then one after another. Right now it seems like you are learning React, Nextjs, Typescript, (Libraries), JSX, (Javascript), CSS, HTML.
That's way to much to start. So, start with the basics: Javascript, CSS, HTML. Then go in the advanced direction: JSX, React, important Libraries. And then go in the OP stuff like: NextJs and Typescript.
I learned all these stuff from this guy: [Codevolution](https://www.youtube.com/@Codevolution)
Very much recommended.
For the beginning I recommend you, you using his crash course, for the topics I wrote down: https://www.youtube.com/watch?v=N8YMl4Ezp4g&list=PLC3y8-rFHvwhuX4qGvFx-wPy_MEi6Jdp7
Please do it, else you won't make it that long in programming
After this playlist you know the basics of webdevelopement and can start big projects like a ecommerce store.
Enjoy the developement journey and best of luck ^^
That's way to much to start. So, start with the basics: Javascript, CSS, HTML. Then go in the advanced direction: JSX, React, important Libraries. And then go in the OP stuff like: NextJs and Typescript.
I learned all these stuff from this guy: [Codevolution](https://www.youtube.com/@Codevolution)
Very much recommended.
For the beginning I recommend you, you using his crash course, for the topics I wrote down: https://www.youtube.com/watch?v=N8YMl4Ezp4g&list=PLC3y8-rFHvwhuX4qGvFx-wPy_MEi6Jdp7
Please do it, else you won't make it that long in programming
After this playlist you know the basics of webdevelopement and can start big projects like a ecommerce store.
Enjoy the developement journey and best of luck ^^
Ivory-billed WoodpeckerOP
in app folder
Header.js
??
no components
folder?
As you see there is very much space for personalization. Do it, however you like
Ivory-billed WoodpeckerOP
if I create components folder
there will be components route
...
do you know next.js ?
Yes, most of the people offering to help know nextjs.
@Ivory-billed Woodpecker do you know next.js ?
Do this: https://nextjs-forum.com/post/1266819757374705714#message-1266823455547068498
And learn learn learn. As much as you can
And learn learn learn. As much as you can
I think @B33fb0n3 is pointing you in the right direction, you need to learn the fundamentals.
Ivory-billed WoodpeckerOP
why you didnt tell it
ok page.js
simple answer
create components folder, without page.js it wont be new route
thats all
without whole story which you wrote
...
@Ivory-billed Woodpecker why you didnt tell it
Well… I told you to learn the basics. And yes, that’s part of the basics. So I could ask the same: why don’t you do that, what I recommend you?
But that’s not my mission. My mission is to solve this specific issue. And I done that. If you follow my recommendations or not is your choice
But that’s not my mission. My mission is to solve this specific issue. And I done that. If you follow my recommendations or not is your choice
Ivory-billed WoodpeckerOP
I knew about it
that page.js
I asked about organization
of project
all things can be basics...
ok thanks for help
@Ivory-billed Woodpecker I asked about organization
The page that I linked has this headline „Project Organization and File Colocation“. So maybe exactly what you needed?
Ivory-billed WoodpeckerOP
yes
Thanks for the clarification. Please mark solution[:](https://cdn.discordapp.com/attachments/1043615796787683408/1117191182133501962/image.png?ex=66a6039e&is=66a4b21e&hm=a2d68dc395336a9b4a8eed9e0a85093d82b0ede35cafc5ea107a11b485f11a47&)
Ivory-billed WoodpeckerOP
could anyone
explain me
should I create client components or server components?
Again, more fundamentals.
If you need interactivity, its a client component. If its just visual and no interactions then its server components. Thats the simple explanation lol
Ivory-billed WoodpeckerOP
hmmm
ok
server components is return from server
You can interweave the different component types as little or as often as you want, passing data between them.
Both are returned from the server, both are initially built on the server. Client components just have some extra javascript that 'hydrate' them on the client
again, very simple explanation for a complicated process.
Ivory-billed WoodpeckerOP
ok but
server components are return from server
plain HTML
Ivory-billed WoodpeckerOP
client components not
yesish again
Ivory-billed WoodpeckerOP
they are render on
client
yes?
Client components still pre-render on the server.
thats why its not a simple yes or no question
Ivory-billed WoodpeckerOP
pre render
hmmm
server components -> SEO
?
Heres a more real world answer/response to your question. Really good points in this reddit thread
https://www.reddit.com/r/nextjs/comments/150i0sx/understand_server_and_client_component_relation/
https://www.reddit.com/r/nextjs/comments/150i0sx/understand_server_and_client_component_relation/
Im going out, good luck.
Please mark @B33fb0n3 answer to your original question.
Ivory-billed WoodpeckerOP
does gallery server component?
for example
@Ivory-billed Woodpecker that’s a very different topic then the initial question. Please mark this thread as solved and open a new thread if needed.