I was editing a javascript file, and when I wrote: p{Hello}
I expected it to convert into <p>Hello</p>
.But it doesn't seem to happen. Is there anything else I need to do to configure this extension in VS Code to make it work? The code is given below.
import React, { Component } from "react";
const ArrowHeader = () => {
return(
p{Hello}
)
}
class App extends Component {
render() {
return (
<div className="App">
<h1>Hello Scaler</h1>
</div>
);
}
}
export default App;
p{Hello} is not a component.
if you want to display <p>Hello</p>
, you need to create a custom component.
Actually, the problem is not with the ES7 extension, but emmet was not configured with javascript files, it works fine after adding javascript as a language for emmet.
-Try adding this to your settings.json file:
"emmet.includeLanguages": {
"javascript": "javascriptreact"
}
-If you don't want that configuration, you can manually change it to each file Language Mode to JavaScript React:
With the .js file open click on the Language Mode Selector: Language Mode Selector
Search for JavaScript React (or JSX): Select JavaScript React
Check if it applied correctly: JSX Mode applied