Gabotronix
2 months ago

Avoid relative path import hell in react-native?

Posted 2 months ago by Gabotronix

Hi everybody, I'm new to react-native coming from vue background, one thing I hate in react is having to use relative path imports in my components, I find myself doing something like:

import HomeScreen from '../../components/screens/HomeScreen'

I f my folder structure changes it means I will have to do a search and replace in all of m components using that component, not cool and prone to be a dev hell.

Is it possible to use absolute paths like with node modules, is there a library where I can use aliases or similar, with vue I could import my components in the app.js like Vue.component('home-screen ...) and I could use them without having to import, please help me out.

Please sign in or create an account to participate in this conversation.