Home > Software engineering >  "ES7 React/Redux/GraphQL/React-Native snippets" is not working for javascript file. Do I n
"ES7 React/Redux/GraphQL/React-Native snippets" is not working for javascript file. Do I n

Time:12-12

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;

CodePudding user response:

p{Hello} is not a component. if you want to display <p>Hello</p>, you need to create a custom component.

CodePudding user response:

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.

  • Related