简体   繁体   中英

Console.log not showing anything in Chrome Console. (React)

在此处输入图像描述 So I am just starting out with React but facing an issue if someone would be kind enough to resolve it. My index.js code is:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const element= 'Hello world'
console.log(element)

The Code above should show "Hello World" when I open the browser and inspect the element but it shows nothing. The tutorial I am watching has "Hello World" showing up. Can someone look into this for me? Thank you

PS: I have added a picture which shows my code layout in VScode

use statement terminator after declaring const element="hello wolrd"; and write to console

I am sorry for the confusion, Apparently, Pycharm saves the file automatically whereas, in VScode, The auto-save feature has been disabled or isn't there. I save my code on VScode using Ctrl+S and now the result is showing in the browser. Thank you, everyone, for the replies

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM