问题
I'm using redux to manage my sidebar visibility state(sidebarvis: true, false). Routing is also managed by redux.
When I click a link to change pages within my visible sidebar, redux is successfully updating the router state, but the content within sidebar.pushable does not update until my sidebar is toggled(AKA until the toggleSideBar action is dispatched).
In other words, redux is working properly, but the page doesn't render until the sidebar is toggled again. Has anyone else had this issue?
回答1:
Found the issue. Semantic-Ui suggests placing the sidebar at the root level so that all of your content is wrapped within Sidebar.Pusher.
This is fine if you are using react state, but if you are using redux, the root (or App level container as we commonly see in examples) container doesn't seem to like being hooked up to the redux store.
I simply created a sidebar component, rendered that within the root container, and passed in all my routes as children to the sidebar.
来源:https://stackoverflow.com/questions/51028558/semantic-ui-sidebar-pushable-wont-update-page-content