const userInfo = useSelectorstate RootState = stateglobalMenu
The code snippet you provided is using the useSelector hook from the react-redux library to access the globalMenu state from the Redux store. The useSelector hook takes a selector function as an argument, which receives the root state of the Redux store and returns the desired slice of the state.
In this case, the selector function (state: RootState) => state.globalMenu is passed to useSelector, where RootState is the type of the root state of your Redux store. The useSelector hook then returns the globalMenu state from the Redux store, which can be accessed and used in the component
原文地址: https://www.cveoy.top/t/topic/hWRE 著作权归作者所有。请勿转载和采集!