如何在 chrome 中解决 jsx 预编译和 React 开发工具

How to solve jsx precompile and React dev-tool in chrome

我尝试学习如何编写 react。
但是当我用 chrome 编写第一个组件时,Chrome 的开发人员工具显示消息

Download the React DevTools for a better development experience

我已经从 Chrome 的应用商店安装了 React DevTools。
我的代码可以用,我只想知道如何解决这些消息。
我的 chrome 设置有误吗?

请有人帮我解决这个问题。

"Download the React DevTools for a better development experience" 的警告应该得到修复 in React 0.12.0 and above when using the latest React DevTools extension。如果您使用的 React 版本早于 0.12,或者您有旧版本的扩展,该消息将继续弹出。

有关使用浏览器内 JSX 转换的警告只是告诉您,您正在将 JSX 语法转换为浏览器中的 JS 函数调用,这速度较慢并且需要相对较大的 JSX 转换器。如果您遵循警告中的 link,您将是 taken to a page that explains further:

Note:

The in-browser JSX transformer is fairly large and results in extraneous computation client-side that can be avoided. Do not use it in production — see the next section.

Productionizing: Precompiled JSX

If you have npm, you can simply run npm install -g react-tools to install our command-line jsx tool. This tool will translate files that use JSX syntax to plain JavaScript files that can run directly in the browser. It will also watch directories for you and automatically transform files when they are changed; for example: jsx --watch src/ build/.

By default JSX files with a .js extension are transformed. Use jsx --extension jsx src/ build/ to transform files with a .jsx extension.

Run jsx --help for more information on how to use this tool.