Recommand · June 9, 2021 0

Is there a shorthand way to import several modules/components in React?

I’m still learning React.js but so far I’m finding that most of my files begin with large lists on import statements. For instance, my App.js file begins like this:

import React from "react"
import Signup from "./Signup"
import { Container } from 'react-bootstrap'
import { AuthProvider } from "../contexts/AuthContext";
import { BrowserRouter as Router, Switch, Route} from 'react-router-dom'
import Dashboard from './Dashboard'
import Login from './Login'
import PrivateRoute from './PrivateRoute'
import ForgotPassword from './ForgotPassword'
import UpdateProfile from './UpdateProfile'

Is there any way to boil down this code with JS, or just something in React? Is there a way to use a separate file for imports or a way to group functions I tend to always import together?