npm设置代理 npm设置仓库1.npm config set registry https://registry.npm.taobao.org npm config list #查看npm当前配置 2.命令行指定 每次执行命令前加入–registry指定仓库路径npm --registry http://172.17.216.121 install3.编辑 ~/.npmrc 加入下面内容regis...
使用npm link关联自己的node modules(项目) 在进行自己的模块开发时,一般我们至少会创建2个项目,一个项目进行自己的modules开发(项目aaa)。另一个项目引入自己开发的modules,进行测试并使用(项目bbb)。这时我们就可以使用npm link关联2个模块:1:进入aaa项目,输入npm link,这时npm会把项目aaa暴露到全局。2:进入bbb项目,输入npm link aaa,这时bbb项目就不会使用...
关于redux-observable的一点理解 推荐2篇个人觉得写的还不错的文章吧redux-observable介绍及和redux-thunk,redux-saga的区别:https://www.jianshu.com/p/c1adaa9d8a39使用 redux-observable 实现组件自治:https://juejin.im/post/5b798501f265da43473130a1说点题外话:也许可...
高版本的angular cli(2以上)如何使用ng eject 在creact react中有eject来暴露出配置文件,但是在angular cli中却只有1.X版本的cli有这个功能https://github.com/angular/angular-cli/wiki/1-x-home2版本以上都没有了https://github.com/angular/angular-cli/wiki(真的坑...官方也没提供个解决方案)那么如果...
Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided. 在使用create-react 构件的TS项目时如果我们想导入一个普通的 .js文件会有以下报错Failed to compileC:/Users/JH55692/rendition_ui/public/readership/adobe/AppMeasurement.jsType error: Cannot compile namespaces when the '--iso...
react-create-app src引入目录外部文件冲突问题:Relative imports outside of src/ are not supported.... 使用react-create-app构建的项目,当src文件夹下文件想引用src文件夹外文件因为官方限制问题会报以下错误。Module not found: You attempted to import ****** which falls outside of the project src/ directory. Relative imports outside of src/...
React 的性能优化 PureComponent 与 ImmutableJS 详见:https://segmentfault.com/a/1190000011408775转载于:https://www.cnblogs.com/jimaww/p/11102882.html
react服务端渲染详解 详见1:https://www.jianshu.com/p/47c8e364d0bc?appinstall=1&mType=Group及2:https://segmentfault.com/a/1190000018672269#articleHeader14react官方:https://zh-hans.reactjs.org/docs/react-dom-server....
CSS实现水平垂直居中的各种方式 原文地址:https://segmentfault.com/a/1190000016389031个人觉得比较好的是通过flex布局来实现,代码简单,且不受具体宽度和高度的影响:#modal-root { /*弹性盒模型*/ display: flex; /*主轴居中对齐*/ ...
前端性能测试之lighthouse 记录一款简单好用的前端性能测试工具:https://github.com/GoogleChrome/lighthouse这是一款基于chorme的测试工具,使用很简单:1 使用npm全局安装2 安装好后在cmd里运行:lighthouse http://localhost:3000 --view --emulated-form-factor desktop-thrott...
在react的TS项目中定义defaultProps 如何在react的TS项目中定义组件的defaultProps,代码如下:import React, { Component } from 'react';import '../../../style/animation/loading.scss';interface ILoadingProps { scale?: number;}interface...
如何去除button选中时的阴影效果 使用box-shadow可以去除button选中时四周的阴影。CSS代码如下(&是sass语法,即当前button元素):button { box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; -o-box-shadow: none; -ms-box-shadow: n...
在用npm install jquery-ui之后如何引入项目并使用 在用webpack或者creact react 构建的前端项目中,如果我们要用jquery-ui一定要像如下这样:import $ from 'jquery'; //必须引入jqueryimport 'jquery-ui/themes/base/draggable.css'; //此css不引入也不影响draggable 功能import 'jquery-ui/them...
React 组件间通讯 转自:http://taobaofed.org/blog/2016/11/17/react-components-communication/转载于:https://www.cnblogs.com/jimaww/p/10647931.html
在react typescript项目中如何使用没有@type定义的npm包 最近在用react重构我们的Angularjs项目,我使用的是create react-app 构建的 使用typescript的react项目其中遇到一个问题就是有的npm包比如: react-loadable 在npm上是没有@types/react-loadable的那么我们如何在符合TS语法的基础上引入这个包呢?首先正常npm install react-loadable...
在TypeScript中如何在window上定义对象 比如我们要在window上定义 Jim最简单的方法就是将window强制类型转换成any,但是不推荐!(window as any).Jim=233;推荐方法:在项目中找到*.d.ts 文件 加上以下代码即可:interface Window { Jim: any; //注意这里如果不写any那么用window.jim是可以的,但是用window.j...
React Loadable结合React Router 4并实现动态加载和模块热替换 基于react原生的代码动态分离:https://reactjs.org/docs/code-splitting.htmlReact Loadable - 以组件为中心的代码分割和懒加载:https://www.jianshu.com/p/697669781276升级到 React Router 4 并实现动态加载和模块热替换:https://www.jianshu.com/p/...
关于react循环渲染中的key 在react中使用map或者其他方法生成DOM时经常看到如下警告:index.js:1446 Warning: Each child in an array or iterator should have a unique "key" prop. See https://fb.me/react-warning-keys for more information.这是因为我们没有为...
关于前端性能优化(Start Render、DOM Ready、Page Load、TTI) 首先了解一下基本概念:前端性能指标分析-Start Render、DOM Ready、Page Load、TTI前端性能量化标准:这篇回答说了一些测量的标准,及测量工具知乎上一篇个人觉得还不错的(其中某些部分可能有点老了,但也写的很透彻了)具体回答了如何优化:网站为什么 JS 调用尽量放到网页底部?知乎https://www.zhihu.com/ques...
React Router 4 与 之前版本(3)的区别 详见:https://www.jianshu.com/p/bf6b45ce5bcc转载于:https://www.cnblogs.com/jimaww/p/10412347.html