A module for managing user interface state.
Used in combination with the Redux store instance dispatch
function, actions can be used in manipulating the current global state.
Sets the currently selected site by site ID.
import { setSelectedSiteId } from 'calypso/state/ui/actions';
dispatch( setSelectedSiteId( 2916284 ) );
The included reducers add the following keys to the global state tree, under ui
:
The currently selected site ID, or null
if no site is selected.
Selectors are intended to assist in extracting data from the global state tree for consumption by other modules.
Returns the currently selected site object.
import { getSelectedSite } from 'calypso/state/ui/selectors';
const selectedSite = getSelectedSite( store.getState() );
Returns the currently selected site slug.
import { getSelectedSiteSlug } from 'calypso/state/ui/selectors';
const selectedSiteSlug = getSelectedSiteSlug( store.getState() );