Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Functional react component not rendering in another component when exported to Chrome debug

I want to render a component in another component. By directly exporting to a chrome debug window, I tested the following code:

function test() {
    return <p>Test</p>;
}

function app() {
    return <test />;
}

export default app;

I expect the result to be equivalent to:

function app() {
    return <p>Test</p>;
}

export default app;

Which should output:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

A blank webpage with the word 'Test'

Instead, I get this:

A blank webpage with no content

Any insight appreciated. I will provide additional information on request, but I am unsure what could be missing.

p.s. ignore blur on address bar, just using chrome account

>Solution :

I would first try capitalizing your components i.e.

   function Test () {
     return <p>Test</p>
   }
   function App () {
     return <Test/>
   }

This could be a similar question: ReactJS component names must begin with capital letters?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading