React 道具不会在组件挂载时呈现

React props don't renders on compomnent mount

我有 Redux store reselect tbodyCommand.reducer.js 和 Redux store with MAKE_TBODY case 我正在调用 makeTbodyArray() 函数,其中包含订阅者和 for() 循环。这个东西与 TableBody 组件(Table 组件的子组件)有关,我试图在其中调用此 props 函数makeTbody()MAKE_TBODY() 一样调度)并通过调用 componentDidMount 它只有控制台日志和负载 comVal props with array in debug tools in state,但不渲染全部在组件中(componentWillReceiveProps 存在并且有效但不渲染全部来自 props 数组)。

所以主要目标是在组件首次加载时在 table 中渲染 comVal 道具。如果我要更改沙盒中的某些内容/重新键入它并保存它将使用道具正确渲染重新渲染它(但它不会正式首次 - 时间 - 应用程序 - 渲染,所以我猜这里的道具来自 prevProps).

https://gvh5n.csb.app/

通过大量的尝试和错误的代码决定,在这种困难的情况下得到了两个答案。第一个是查看 https://github.com/tannerlinsley/react-query react-query library and it's examples. And the variant that I used for me is just to make a promise and setStateAsync function to make state editable in promise from this question . Here is my code https://xmzx3.csb.app/ 。 因此 promisecomponentDidMount 函数中对 re-render 组件在获取 props 函数结果后可用。