星期日, 10月 22, 2017

[react.js] 初學筆記

記錄一下react.js學習上要懂的ecosystem,
做一下自已要速查的note

npm套件管理工具

node.js用來裝需求的套件的工具,安裝完的套件可以給node.js後端用或透過webpack ES6方法來載入套件

webpack build tool (可以用Gulp+browserify)

因為早期都用gulp,但webpack出到v3了,這次就換試webpack這個工具

星期三, 10月 18, 2017

[react.js] 雷雷小伙伴之坑

記錄一下菜B巴react.js之旅的error


Warning: Invalid DOM property `class`. Did you mean `className`?

就是JSX裡面用了html的保留字class啦,要用className

Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object


//死亡的原因是import加了{}
// import { App}  from './components/App';
import  App  from './components/App';

星期三, 10月 11, 2017

[node.js] 如何切換development與production模式

有關node.js處理NODE_ENV來切換developer/production的方法種類

export NODE_ENV=production
Or if you are in windows you could try this:
SET NODE_ENV=production
or you can run your app like this:
NODE_ENV=production node app.js
You can also set it in your js file:
process.env.NODE_ENV = 'production';
https://stackoverflow.com/questions/9198310/how-to-set-node-env-to-production-development-in-os-x