0

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;

2
  • Remember the more data u give more help could arrive, and try to make ur question searchable, right now ur title is not good for ur content because its too broad. Commented Dec 11, 2021 at 7:50
  • thankyou, i will surely keep this in mind from now. Commented Dec 11, 2021 at 7:59

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

no, actually i was trying to use snippets, i.e., I wanted p{Hello} to convert into <p>Hello</p> on pressing the enter key. But its not happening so I thought there is some configuration error with my ES7 extension for VS Code.
0

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.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

-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:

  1. With the .js file open click on the Language Mode Selector: Language Mode Selector

  2. Search for JavaScript React (or JSX): Select JavaScript React

  3. Check if it applied correctly: JSX Mode applied

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.