LEJ
LEJ

Reputation: 1958

React/Node - Include js component in another file

I have a component in a .js file which I have exported as default. I am trying to include this component in another .js file. I have also imported this component in the other file. I have tried using <componentName /> but this does not seem to work, it compiles and shows no error but nothing shows up. Any ideas?

Upvotes: 0

Views: 273

Answers (2)

Surya Purohit
Surya Purohit

Reputation: 1120

First of all, as you are saying you are using it like <componentName />, this won't work, you should try renaming it with all caps ie. <ComponentName />. This is just an assumption. If the issue persists, please share the code, so that we can help you in a better way. Discussion can be found here.

Upvotes: 1

LEJ
LEJ

Reputation: 1958

As mentioned in the comments, the component name that I was attempting to add is required to start with a capital letter as components beginning with lowercase letters are searched as default DOM elements

Upvotes: 0

Related Questions