How to turn on/off ReactJS 'development mode'?

后端 未结 7 1276
独厮守ぢ
独厮守ぢ 2020-11-29 17:38

Started using ReactJS\'s prop validation feature, which as the docs say only works in \'development mode\' for performance reasons.

React seems to be validating the

7条回答
  •  半阙折子戏
    2020-11-29 18:08

    If you're working from something like this ReactJS.NET / Webpack tutorial, you can't use process.env to switch React development mode on/off as far as I can tell. This sample links to react.js directly (see Index.cshtml), so you just have to pick .min.js or the non-minified variant by changing the URL.

    I'm not sure why that is the case, because the sample's webpack.config.js has a comment that seems to imply the externals: { react: 'React' } would do the job, but then goes ahead and includes react directly into the page.

提交回复
热议问题