Using localStorage or/and cookies in server side component
Answered
Pond loach posted this in #help-forum
Pond loachOP
How am i able to get localStorage and cookies from client side in the server side component?
Answered by B33fb0n3
something in your message does not match... a server component is rendered on the server and not on the client side.
The server does not know any localstorage, because it's local. So inside the browser of the user. And that means: only clientside. You can access it via
The cookies can be access using nextjs only though server components like
The server does not know any localstorage, because it's local. So inside the browser of the user. And that means: only clientside. You can access it via
localStorage.#The cookies can be access using nextjs only though server components like
cookies().#. Of course you can also access the them clientside via third party libraries4 Replies
@Pond loach How am i able to get localStorage and cookies from client side in the server side component?
something in your message does not match... a server component is rendered on the server and not on the client side.
The server does not know any localstorage, because it's local. So inside the browser of the user. And that means: only clientside. You can access it via
The cookies can be access using nextjs only though server components like
The server does not know any localstorage, because it's local. So inside the browser of the user. And that means: only clientside. You can access it via
localStorage.#The cookies can be access using nextjs only though server components like
cookies().#. Of course you can also access the them clientside via third party librariesAnswer
@Pond loach solved?
@B33fb0n3 <@655679234026504202> solved?
Pond loachOP
Yes sir
happy to help