skip to Main Content

I’m a newbie on react and my react Code is not showing in my browser its just blank what could be the problem?
An image of it

App.js file:

import React from ‘react’

const App = () => {
return (
E-commerce
)
}

export default App;

index.js file:

import React from "react";
import ReactDOM from "react";

import App from "./App";

ReactDOM.render(, document.getElementById("root"));

2

Answers


  1. Please provide your code setup, how you are trying to code in React, and how you bootstrapped your app. If you could attach screenshots, it would be great.

    From your information, I can see that you are trying to show "E-commerce" on the page. You could try wrapping that word inside a react fragment. For example,

    return <>E-Commerce</>;
    
    Login or Signup to reply.
  2. This line doesn’t look right.

    import ReactDOM  from "react";
    

    The ReactDOM should come from react-dom instead of `react, which means you should probably be able to get things working by updating that line to

    import * as ReactDOM from "react-dom";
    

    Read more here https://legacy.reactjs.org/docs/react-dom.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search