Reputation: 8575
I want to achieve something like this:
import {colors} from '../../basestyle'
export const colours = colors
but with the same name for imported and exported constants.
Upvotes: 0
Views: 49
Reputation: 6368
You won't believe it. Its a one liner:
export * from '../../basestyle';
or you will be able to do this:
export {colors} from '../../basestyle';
Update to OP's comment:
To use it in same file and also export after importing it you can do it like this:
export { colors } from '../../basestyle';
const MyComponent = props => {
console.log(colors);
return <div>;
}
export default MyComponent;
Upvotes: 1
Reputation: 5669
To export only colors, you can do the following,
export { colors } from '../../basestyle';
To export all the exported content from '../../basestyle'; you can,
export * from '../../basestyle';
Upvotes: 2