We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
现在RexProvider在useEffect里面去开始订阅变更,但是RexProvider又在最外层,所以它的useEffect最晚触发,所以在渲染时,子组件对store的更新,都会丢失。除非在子组件里使用setTimeout进行延时,等RexProvider的useEffect生效,但这个比较挫。
第二,更新时,没有callback,例如this.setState,会有一个callback,来通知这个更新已经完成,可以做下一步。现在调用store.update(),没有一个callback可以知道rex已经渲染完成。
The text was updated successfully, but these errors were encountered:
对于第一个问题,比较复杂,我还没想清楚。
第二个问题可能可以用useState解决
const RexProvider = (props) => { const [store, setStore] = useState(); useEffect(() => { props.callback(store); }, [store]); }
Sorry, something went wrong.
No branches or pull requests
现在RexProvider在useEffect里面去开始订阅变更,但是RexProvider又在最外层,所以它的useEffect最晚触发,所以在渲染时,子组件对store的更新,都会丢失。除非在子组件里使用setTimeout进行延时,等RexProvider的useEffect生效,但这个比较挫。
第二,更新时,没有callback,例如this.setState,会有一个callback,来通知这个更新已经完成,可以做下一步。现在调用store.update(),没有一个callback可以知道rex已经渲染完成。
The text was updated successfully, but these errors were encountered: