React Native | import file performance

Import the component from another file like

import BackButton from '../components/BackButton'

or you could also use component indexing for better import like “components/index.js”

import BackButton from "./BackButton";
import Loader from "./Loader";
import Text from "./Text";

export {
  Loader,
  ButtonView,
  Text
};

Usage like

import {BackButton} from '../components'

It does not affect the performance but component indexing is a better approach to implement when you have multiple files in the component

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top