“Reactjs”的版本间的差异

来自tomtalk
跳转至: 导航搜索
Tom讨论 | 贡献
安装
第2行: 第2行:
  
 
==安装==
 
==安装==
 +
 +
1. 升级nodejs(8.8.1)、npm(5.4.2)到最新版。
 +
2. 在本地生成react项目。
 +
<source lang="bash">
 +
npx create-react-app my-app
 +
</source>
 +
3. 启动项目。页面显示在3000端口,代码修改后会自动刷新页面。
 +
<source lang="bash">
 +
npm start
 +
</source>
 +
4. 打包生产代码。
 +
<source lang="bash">
 +
npm run build
 +
</soruce>
  
 
==bind(): React component methods may only be bound to the component instance.==
 
==bind(): React component methods may only be bound to the component instance.==
  
 
If you get this error: bind(): React component methods may only be bound to the component instance. It’s probably because you are using ES5 bind on a component property in order to curry a property and you are passing in a scope as the first argument (such as this). A simple fix is to pass null in as the scope argument.
 
If you get this error: bind(): React component methods may only be bound to the component instance. It’s probably because you are using ES5 bind on a component property in order to curry a property and you are passing in a scope as the first argument (such as this). A simple fix is to pass null in as the scope argument.

2017年10月26日 (四) 09:29的版本

快速入门

安装

1. 升级nodejs(8.8.1)、npm(5.4.2)到最新版。 2. 在本地生成react项目。

npx create-react-app my-app

3. 启动项目。页面显示在3000端口,代码修改后会自动刷新页面。

npm start

4. 打包生产代码。

npm run build
</soruce>
 
==bind(): React component methods may only be bound to the component instance.==
 
If you get this error: bind(): React component methods may only be bound to the component instance. It’s probably because you are using ES5 bind on a component property in order to curry a property and you are passing in a scope as the first argument (such as this). A simple fix is to pass null in as the scope argument.