menu

Questions & Answers

Classname auto-completion in React css

I found out that in ReactJS, there is no add-ons which auto-completes ClassNames while coding CSS File.

import './log-in.css';

function Login() {
  return <div className='LoginForm'>
       Hello World
    </div>
}

export default Login;

If we want to apply CSS tag into LoginForm, should we manually write down all ClassName? or is there any add-ons that I can use to have ClassName auto-completion.

Answers(1) :

You can add the below code to your VSCode Settings.json file. The settings.json will be found at vscode setting -> Code Action on save -> Edit on Settings.json

{
  "emmet.includeLanguages": {
    "javascript": "javascriptreact",
    "typescript": "typescriptreact"
},
}

Hope this will solve your problem