gpt4 book ai didi

reactjs - 使用 Rails 布局从其他 React 组件渲染 React 组件

转载 作者:行者123 更新时间:2023-12-03 14:07:45 27 4
gpt4 key购买 nike

我试图在成功提交表单时呈现其他组件。表单具有不同的轨道布局,表单提交后它会以不同的布局进行重定向。

使用react-router和重定向对象渲染组件,但如何使用布局渲染它。我还想在表单提交后显示 Flash 消息并使用react。因此,如果在提交表单后重新加载页面,则无法在 react 组件中设置闪存消息。有什么建议吗?

谢谢。

最佳答案

试试这个也许会有帮助

https://github.com/reactjs/react-rails/issues/901

If you want to write the layout by using React Component, you should render your contents in the layout component. In this case, all props should be passed to the Layout component at first and then you can pass some props to the child components

关于reactjs - 使用 Rails 布局从其他 React 组件渲染 React 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50247609/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com