Server-side variables to Client-Side with React-Engine and Express

后端 未结 2 441
一个人的身影
一个人的身影 2021-02-05 15:14

I\'m reasonably new to React/React-Engine. I have a config on the server-side that I need to pass certain values of to client-side however I have a dependency on NODE_ENV in ord

2条回答
  •  臣服心动
    2021-02-05 15:58

    The most common way to pass data from the server to client before rendering is to embed it in a global JavaScript variable on the page where your React is rendering.

    So, for example, in the middleware where you're actually rendering some template which includes your

提交回复
热议问题