tb-react
React library for building internal portal
connect()
import * as tb from 'tb-react'
tb.connect(map, transformers)(MyComponent)
map
is something like redux
(mapStateToProps(state, ownProps)
and mapDispatchToProps(dispatch)
)
componentProps
Form
@tb { const form newProp = thisprops return <div> form </div> }
actions
const accountFieldSchema = field: 'username' title: 'Username' type: 'string' field: 'password' title: 'Password' type: 'string' field: 'UpFrom' title: 'Up từ' type: 'number' field: 'UpTo' title: 'Đến' type: 'number' field: 'SleepTime' title: 'Thời gian chờ (giây)' type: 'number' field: 'IsVIP' title: 'VIP' type: 'boolean' const accountSchema = const accountFields = accountSchemafields;const accountFieldTitles = accountSchematitles; const accountActions = ...state site: data load: // Clean all accounts data {} const accountFilterActions = { const ret = {} if statefields < 0 retfields = ...statefields field else retfields = statefields retdata = ...statedata field: value // console.log(ret); return ret } change: accounts: accountActions {} accountFilter: accountFilterActions fields: data: {}