How to import the same component multiple times in order to set different displayNames?

212 Views Asked by At

I'm importing the Button component from our design-system. I want to import it multiple times by renaming it (e.g. import {Button as Btn, Button as MyBtn} from 'design-system' and then assign different displayName to them, via:

Btn.displayName = 'Btn';
MyBtn.displayName = 'MyBtn';

React however is giving MyBtn to all the Buttons present in the component. How can I achieve my objective?

0

There are 0 best solutions below