DEV Community

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

Posted on • Edited on

1

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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay