Xiaopei's DokuWiki

These are the good times in your life,
so put on a smile and it'll be alright

User Tools

Site Tools



  • 千万别用 node-sass,根本下不来,根本 build 不通过,在这上面耗了 N 小时,再做项目只用纯 js 库


$ yarn config get registry
# -> https://registry.yarnpkg.com
# 可以改成 taobao 的源:
$ yarn config set registry 'https://registry.npm.taobao.org'
# -> yarn config v0.15.0
# -> success Set "registry" to "https://registry.npm.taobao.org".
# -> Done in 0.04s.

ant design / antd

react router


Why isn't my component re-rendering, or my mapStateToProps running?

Accidentally mutating or modifying your state directly is by far the most common reason why components do not re-render after an action has been dispatched. Redux expects that your reducers will update their state “immutably”, which effectively means always making copies of your data, and applying your changes to the copies. If you return the same object from a reducer, Redux assumes that nothing has been changed, even if you made changes to its contents. Similarly, React Redux tries to improve performance by doing shallow equality reference checks on incoming props in shouldComponentUpdate, and if all references are the same, returns false to skip actually updating your original component.

It's important to remember that whenever you update a nested value, you must also return new copies of anything above it in your state tree. If you have state.a.b.c.d, and you want to make an update to d, you would also need to return new copies of c, b, a, and state. This state tree mutation diagram demonstrates how a change deep in a tree requires changes all the way up.

Note that “updating data immutably” does not mean that you must use Immutable.js, although that is certainly an option. You can do immutable updates to plain JS objects and arrays using several different approaches:

Copying objects using functions like Object.assign() or _.extend(), and array functions such as slice() and concat() The array spread operator in ES6, and the similar object spread operator that is proposed for a future version of JavaScript Utility libraries that wrap immutable update logic into simpler functions





  • android 调 js
    • loadUrl(“javascript:alert('hehe')”)
    • evaluateJavascript (String script, ValueCallback<String> resultCallback)
    • This method must be called on the UI thread 必须在 UI 线程调用
  • js 调 android
    • android 捕捉 url
    • JavascriptInterface
it/react.txt · Last modified: 2017/06/15 22:00 by admin