Back to Novu

NovuProvider

docs/platform/sdks/react-native/hooks/novu-provider.mdx

3.18.02.2 KB
Original Source

The NovuProvider is the top-level component that provides the Novu instance to the rest of the hooks through the context. Usually, it's placed somewhere in the root of your application, which makes the hooks accessible throughout the application.

Props

PropTypeRequiredDescription
subscriberIdstringYesThe unique identifier of the subscriber
applicationIdentifierstringYesYour application identifier from Novu
subscriberHashstringNoHMAC encryption hash for the subscriber
apiUrlstringNoCustom api url for self-hosted instances
socketUrlstringNoCustom socket URL for self-hosted instances
childrenReactNodeYesThe child components that will have access to the Novu context

Example Usage

<Tabs> <Tab> ```tsx
function App() {
  return (
    <NovuProvider
      subscriber="SUBSCRIBER_ID"
      applicationIdentifier="APPLICATION_IDENTIFIER"
    >
    </NovuProvider>
  );
}
```
</Tab> <Tab> ```tsx
function App() {
  return (
    <NovuProvider
      subscriber="SUBSCRIBER_ID"
      applicationIdentifier="APPLICATION_IDENTIFIER"
      apiUrl="https://eu.api.novu.co"
      socketUrl="wss://eu.socket.novu.co"
    >
    </NovuProvider>
  );
}
```
</Tab> <Tab> <Note> Read more about [HMAC Encryption](/platform/inbox/prepare-for-production#secure-your-inbox-with-hmac-encryption). </Note>
```tsx

function App() {
  return (
    <NovuProvider
      subscriber="SUBSCRIBER_ID"
      applicationIdentifier="APPLICATION_IDENTIFIER"
      subscriberHash="SUBSCRIBER_HASH_HMAC_ENCRYPTION"
    >
    </NovuProvider>
  );
}
```
</Tab> </Tabs>