Im totally new in Ts so, i was wondering if I can import all classes i have into one ts file then export it from there, so whenever i want any class i can import it directly from this file
import Login from "./Login/login_page";
import MyAccount from "./AccountSettings/myAccount_page";
import Settings from "./AccountSettings/settings_page";
import DataProvider from "../utils/data-provider/data-provider";
export default { Login, MyAccount,Settings, DataProvider};
CodePudding user response:
Yes, You can do it. But there can be atmost one default export in a file. So, you can have it or not, its optional.
So, for example :
import Login from "./Login/login_page";
import MyAccount from "./AccountSettings/myAccount_page";
import Settings from "./AccountSettings/settings_page";
import DataProvider from "../utils/data-provider/data-provider";
export default DataProvider;
export { MyAccount,Settings, DataProvider} ;
or
import Login from "./Login/login_page";
import MyAccount from "./AccountSettings/myAccount_page";
import Settings from "./AccountSettings/settings_page";
import DataProvider from "../utils/data-provider/data-provider";
export {DataProvider, MyAccount,Settings, DataProvider} ;