React Native Library
Install SDK in React Native Environment
How to add IMQABridge may vary depending on development using React Native.
1. IMQA Settings by Component
Setting up Functional Components
To collect performance data from React Native apps, you need to insert the IMQA collection code per component screen. The collection code is written as a functional component, and the settings vary depending on whether it is a parent or a child component. First, the following settings should be applied according to a parent component rendered first and a child component imported and used by the parent component.
( parent component )
// MpmAgent import
import MpmAgent from ‘imqa-react-native-agent’;
..
const MyComponent = () => {
..
useLayoutEffect(() => {
// These settings must be applied in useLayoutEffect Hook
// as they are functions that should be called before the screen is rendered.
MpmAgent?.setBehaviorData("MyComponent");
}, []);
useEffect(() => {
// It should be located at the top of the useEffect function.
MpmAgent?.startReactNativeRender("MyComponent",true);
..
// It should be located at the bottom of the useEffect function.
MpmAgent?.endReactNativeRender("MyComponent",true);
}, []);
..
} ( child component )
Setting up Class Components
To collect performance data from React Native apps, you need to insert the IMQA collection code per component screen. The collection code is written as a functional component, and the settings vary depending on whether it is a parent or a child component. First, the following settings should be applied according to a parent component rendered first and a child component imported and used by the parent component.
( parent component )
( child component )
2. Setting up Network Communication
Using Axios for Network Communication
If you are using the Axios library for network communication, you must implement an interceptor to inject the code to allow the IMQA collection code to work over network communication.
Using Fetch for Network Communication
If you are using Fetch for network communication, you must insert the code in the form below in order for the IMQA collection code to work over network communication.
Last updated