DEV Community

Cover image for React-js-Identifier-has-Already-been-Declared-(solution)
Osman Forhad
Osman Forhad

Posted on • Updated on

React-js-Identifier-has-Already-been-Declared-(solution)

i have been working in a React js small project the project purpose is Build QrCode Geneator.
So when i go to run this project i got an error which is Identifier-Text-has-Already-been-Declared
the errors screen shot is like bellow:

React js Identifier already declared error (solution)
after seen this type of error i fell wonder and think why this is happen and then i try to find where is the problem, why this is happening. after thinking some time i realize and find what i did and that's all of my mistake. When i solve the issue i think it's very funny and interesting so i decide to share this with all of you internet people.

So why Identifier-Text-has-Already-been-Declared error happen: this all of my mistake i have declared my Component File Name is Text.js but Text is a React Component which i also call from React-bootstrap.. ha ha ... what a funny mistake i did. so what was the actual scenario. Please see The error scenario in below Screen shot:

Identifier already declared error
So i solve this, How i solve this:
it's very easy i think you already understand how i was solve this.. ha ha ....
i just rename my component file from Text.js to Handler.js . cause Text is Component of React js and its a React js Own Component and we cant import any Component twice in React js.
and this is the Reason why i am getting React js Identifier already declared error
after solve the issue my source code scenario is like bellow screen shot:

Identifier-Text-has-Already-been-Declared-solution
and that's it
Happy Coding
.
osman forhad
Full-Stack Developerđź’» (Mobile App & Web App)
developer.osmanforhad@gmail.com

Top comments (0)