Why and How one can Use Absolute Imports in React | by Sabesan Sathananthan | Oct, 2021

0
63


import {MyComponent} from ‘elements/MyComponent’;

Utilizing TypeScript

Utilizing JavaScript

import {MyComponent} from ‘elements/MyComponent’;
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@element/*": ["src/components/*"],
}
}
}
import {MyComponent} from ‘@element/MyComponent’;

For VS Code

For WebStrom / IntelliJ Thought

With ESLint

By Conference