> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# 

# GlobalProps

APISummary
`lynx.__globalProps` is a global object that you can access from anywhere.

- It is read-only in the front-end code, you cannot modify its value.
- The client can set and update its value by calling APIs provided by the Lynx SDK.
- Every time the client performs an update, it will trigger the `onGlobalPropsChanged` event, followed by a re-rendering of the entire page.

## Usage

```tsx
// The properties within the `lynx.__globalProps` object are not managed by Lynx itself.
// Therefore, you must extend its interface yourself.
declare module '@lynx-js/types' {
  interface GlobalProps {
    appTheme: string;
    title: string;
  }
}

function App() {
  const themeClass = useMemo(
    () => `theme-${lynx.__globalProps.appTheme}`,
    [lynx.__globalProps.appTheme],
  );

  return (
    <view class={themeClass}>
      <text>{lynx.__globalProps.title}</text>
    </view>
  );
}
```

## Event Listening

You can listen for changes to `__globalProps` in your component.

```tsx
import { useLynxGlobalEventListener } from '@lynx-js/react';

export function App() {
  useLynxGlobalEventListener('onGlobalPropsChanged', () => {
    console.log('onGlobalPropsChanged', lynx.__globalProps);
  });

  return <view />;
}
```

## Client side

`__globalProps` can be updated through APIs provided by `LynxView`.

### Android

```java
void updateGlobalProps(@NonNull Map<String, Object> props)

void updateGlobalProps(@NonNull TemplateData props)

```

### iOS

```objc
- (void)updateGlobalPropsWithDictionary:(NSDictionary<NSString*, id>*)data

- (void)updateGlobalPropsWithTemplateData:(LynxTemplateData*)data
```

## Compatibility

**Compatibility Table**

**Query:** `lynx-api.lynx.globalProps`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-api/lynx/globalProps.json) · [API Reference](/next/api/lynx-api/lynx/lynx-global-props)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| globalProps | Yes (1.3) | Yes (3.4) | Yes (1.3) | Yes (3.5) | Yes (3.5) | Yes |

**`globalProps`**

global data set by client.

