英文:
How to console log in Hydrogen v1 server components
问题
我是一个初学者,开始使用基于React的无界商务堆栈Hydrogen,然而,当我尝试在.server.tsx
组件中使用console.log
时,我没有得到任何输出。我该如何做?
英文:
I am a beginner starting using Hydrogen the react-based headless commerce stack, however when I try to console.log
in .server.tsx
components, I dont get any outputs.
How can I do that?
答案1
得分: 0
在组件内部进行控制台操作时,它将被视为客户端,并且您将能够在浏览器控制台中看到该控制台。
但是,在服务器组件内部进行控制台操作时,它将在服务器端运行,因此该控制台将在您启动本地开发应用程序的终端中可见。
英文:
While doing console inside component, it will treat it as client side and you will be able to see that console in browser console.
But while doing console inside server component, it will be running on server side, thus that console will be visible in terminal from where you have started your application for local development.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论