Open changtimwu opened 6 years ago
react redux typescript static typing guide https://github.com/piotrwitek/react-redux-typescript-guide
about statex https://github.com/rintoj/statex/tree/master/examples/todo-react-ts
four roles
statex
's represent action with class so it can define action and its creator(factory) at once.@data
@inject
on the React.Componet rendering the state. You can access the state through this.props
model
model
is a class. It can have member functions.store
.
state values
in its internal state. This is done by @observable
.store
defined with store method decorated with @action
state
reading can be done with store class functions
@computed
if this operation doesn't have the observable
state changed.get
if you want to access them like variable index
-> App
->(header
, footer
, todo-list
)container
底下 Provider
tag 用 store 當 props, 想像成, 被Provider
包起來的 component instance, 都可以引用 store.Provider
傳 store instance 下去, TodoTextInput
const { todos, ...actions } = // 除了 todos, 其餘都是 actions
<TodoList todos={filteredTodos}
completeAll={todoStore.completeAll}
deleteTodo={todoStore.deleteTodo}
editTodo={todoStore.editTodo} />
noImplicitThis
and strictNullChecks
in tsconfig.json
http://eddychang.me/blog/16-javascript/45-spread-operator-rest-parameters.html
let aobj={a:1,b:2}
let dobj={g:'yes', ...aobj}
console.log(dobj)
//{ g: 'yes', a: 1, b: 2 }
let alist=[7,9,8]
let clist=[1,2,...alist]
console.log(clist)
// [ 1, 2, 7, 9, 8 ]
https://facebook.github.io/react-native/docs/running-on-device.html
xcode
, open the project.xcode under the ios
sub-directoryAcceptance test for RN https://calaba.sh/
official
expo
.on device
deploy targets are actually running through theexpo
app.eject
others