react.dev
react.dev copied to clipboard
[Beta] Better imports for icon components
Creating an index.ts file in components/Icon that would just import all the icon components and export them.
// components/Icon/index.ts
import {IconCopy} from './IconCopy';
export {IconCopy};
Why do this?
The old import
import {IconCopy} from '../Icon/IconCopy';
would then be replaced with
import {IconCopy} from '../Icon';
thus creating a better readable code.