小编Asa*_*mel的帖子

How to define type in a array of context in react

I have a context:

export const templateContext = createContext({
  isButtonDisable: true,
  setIsButtonDisable: (p: boolean) => {},
  isSubmitReady: <boolean>false,
  setIsSubmitReady: () => {},
  buttonShow: false,
  handleButtonShow: (val: boolean) => {},
  steps:  [] ,
  handleSteps: (val: never) => {},
});
Run Code Online (Sandbox Code Playgroud)

I am not understanding How can I define the type of array in this context. especially the steps array. That array also contains object

typescript reactjs react-context

2
推荐指数
1
解决办法
313
查看次数

标签 统计

react-context ×1

reactjs ×1

typescript ×1