[antd,umijs] how to modify the selectedKeys implementation background highlight of other page Menu components

the Menu component is placed in the layout page, and
then includes other pages components through the configuration route of umi.
can now jump and highlight the background by clicking on any Item of Menu directly on the page.
but if there is a Link link in the page of other components, I think the corresponding Menu.Item background can be highlighted after clicking. The API that provides selectedKeys in
antd can be modified. I try to determine window.location.pathname in layout and compare it with url in routes array, and then find out that there is a problem with index to update selectedKeys, written in componentDidMount. The layout page component only loads once.
now there are two solutions: one is to find out the life cycle that layout can trigger each time the page jumps, and the other is to find a way to pass the props of layout to the {this.props.children} component, and then modify the selectedKeys, through status promotion.
I wonder if this is possible or is there a better way?
so how should I modify the selectedKeys of the Menu of the layout page when the child component jumps?

< hr >

has been implemented for the time being, and the solution is to get the key key bound to selectedKeys,
when the layout page render, so that the value of selectedKeys can be updated every time you jump to the page, but you need to maintain a routes array to map the relationship between url and key.

Jan.30,2022
Menu