> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: getState()

## Article: getState()

## Article Link: https://dev.wix.com/docs/sdk/host-modules/editor/react-elements/states/get-state.md

## Article Content:

<!-- Source: packages/public-editor-platform-sdk/src/element/index.ts in wix-private/editor-platform -->
# getState()

Retrieves the active state of the selected component.

## Syntax

```ts
function getState(): Promise<string | null>
```

## Returns

`Promise<string | null>`

The key of the active state, or `null` if the component is in its default state.

## Example

```js
import { reactElements } from '@wix/editor';

const state = await reactElements.getState();
```

## See also

- [setState()](https://dev.wix.com/docs/sdk/host-modules/editor/react-elements/states/set-state.md)
- [getStateDefinitions()](https://dev.wix.com/docs/sdk/host-modules/editor/react-elements/states/get-state-definitions.md)
- [About the React Elements API](https://dev.wix.com/docs/sdk/host-modules/editor/react-elements/introduction.md)