MCPcopy
hub / github.com/kenberkeley/react-demo / getInitState

Function getInitState

src/components/Msg/MsgForm/index.js:8–8  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6/* 为什么不直接 const initState = { ... } 而是用函数返回呢?
7 皆因直接传 initState 仅是传引用,initState 本身可被修改 */
8const getInitState = () => ({ id: '', title: '', content: '' })
9
10/* 由于本组件由 /msg/add 与 /msg/:msgId 所公用
11 因此需要判断当前是“新增模式”还是“修改模式” */

Callers 2

constructorMethod · 0.85
updateStateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected