Skip to main content

Application Container

The Application container is designed to handle network status changes and display appropriate toast notifications. It comes with built-in functionality that automatically handles these changes.

Features

  • Built-in Offline/Online Notifications: The Application component monitors the network status and shows toast messages when the app goes offline or comes back online.
  • Custom Hooks: It leverages the useToasts and useOfflineStatus hooks from within @nmfs-radfish/react-radfish package.

How It Works

Built-in Offline/Online Notifications

The Application component has built-in functionality to check the application's network status and display toast notifications when the state changes:

  • When the application goes offline: A warning toast is displayed with the message "Application is offline".
  • When the application comes back online: An info toast is displayed with the message "Application is online".

This feature is provided out of the box and requires no additional setup from your side.

Example Usage

To use the Application component, wrap it around your app in the entry file (e.g., index.js or index.jsx):

import { Application } from "@nmfs-radfish/react-radfish";

function App () {
return (
<Application>
{ /* Your application code */ }
</Application>
);
}

export default App;