|
Download wp-calypso/client/state/ui/README.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/README.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/ui/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/README.md
1.17 kB
UI State
A module for managing user interface state.
Actions
Used in combination with the Redux store instance dispatch function, actions can be used in manipulating the current global state.
setSelectedSiteId( siteId: Number )
Sets the currently selected site by site ID.
import { setSelectedSiteId } from 'calypso/state/ui/actions';
dispatch( setSelectedSiteId( 2916284 ) );
Reducers
The included reducers add the following keys to the global state tree, under ui:
selectedSiteId
The currently selected site ID, or null if no site is selected.
Selectors
Selectors are intended to assist in extracting data from the global state tree for consumption by other modules.
getSelectedSite( state: Object )
Returns the currently selected site object.
import { getSelectedSite } from 'calypso/state/ui/selectors';
const selectedSite = getSelectedSite( store.getState() );
getSelectedSiteSlug( state: Object )
Returns the currently selected site slug.
import { getSelectedSiteSlug } from 'calypso/state/ui/selectors';
const selectedSiteSlug = getSelectedSiteSlug( store.getState() );