React+Node.js实战(1):开发环境搭建

安装Node.js

# 官网下载Node.js安装包(LTS版)
https://nodejs.org/zh-cn/

# 执行安装并验证是否成功
node --version

# npm
npm -version
npm -help

# cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm -version

# yarn(速度快、安全、可靠)
https://yarnpkg.com/
npm install -g yarn
yarn -version

# npm 与 yarn 常用命令对比
npm init               / yarn init
npm install            / yarn
npm install --save     / yarn add
npm install --save-dev / yarn add --dev
npm update             / yarn upgrade
npm uninstall          / yarn remove
npm install -g         / yarn global add
npm update -g          / yarn global upgrade
npm ls -g              / yarn global list
npm uninstall -g       / yarn global remove

创建node的http服务

const http = require("http");
const data = {
	code:200,
	data:{
		name: "hello node.js"
	},
	msg:"请求成功"
}

http.createServer((request,response) =>{
	response.writeHead(200,{"Content-Type":"application/json"});
	response.end(JSON.stringify(data));
}).listen(8096);

console.log("server runing at http://localhost:8096/");

 

React的安装

# 全局安装create-react-app工具
npm install -g create-react-app

# 使用create-react-app工具搭建react工程
create-react-app projectName

# 启动react
npm run start // 或者 npm start // yarn start

# 构建打包
npm build // 或者 yarn build

R

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
{ type: "searchSelect", placeholder: "签约机构", valueName: 'signOrganId', optionName: "label", searchItemName: "label", optionId: "key", searchApi:commonService.orgPageList({}).then(res=>{ const {retData}=res retData.map(item=>{ return {key: item.id, label: item.organName, value: item.id,} }) }) }, 分析一下此段代码的报错 汉语解释 ,并修改searchApi中的代码,index.jsx:55 Uncaught TypeError: item.searchApi is not a function at searchQuery (index.jsx:55:1) at onFocus (index.jsx:129:1) at onContainerFocus (BaseSelect.js:326:1) at HTMLUnknownElement.callCallback (react-dom.development.js:188:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:237:1) at invokeGuardedCallback (react-dom.development.js:292:1) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:306:1) at executeDispatch (react-dom.development.js:389:1) at executeDispatchesInOrder (react-dom.development.js:414:1) at executeDispatchesAndRelease (react-dom.development.js:3278:1) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:3287:1) at forEachAccumulated (react-dom.development.js:3259:1) at runEventsInBatch (react-dom.development.js:3304:1) at runExtractedPluginEventsInBatch (react-dom.development.js:3514:1) at handleTopLevel (react-dom.development.js:3558:1) at batchedEventUpdates$1 (react-dom.development.js:21871:1) at batchedEventUpdates (react-dom.development.js:795:1) at dispatchEventForLegacyPluginEventSystem (react-dom.development.js:3568:1) at attemptToDispatchEvent (react-dom.development.js:4267:1) at dispatchEvent (react-dom.development.js:4189:1) at unstable_runWithPriority (scheduler.development.js:653:1) at runWithPriority$1 (react-dom.development.js:11039:1) at discreteUpdates$1 (react-dom.development.js:21887:1) at discreteUpdates (react-dom.development.js:806:1) at dispatchDiscreteEvent (react-dom.development.js:4168:1)
07-14

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值