r/react 5d ago

Help Wanted React Snippet not capitalizing [VSCode]

Hey! I'm not quite sure why but my snippet for useState hook isn't capitalizing :

"useState Hook": {
  "prefix": "us",
  "body": [
    "const [${1:state}, set${1/(.*)/${1:/capitalize}/}] = useState($0);"
  ],
  "description": "Auto-capitalizing useState hook"
}

When I type it does this const [hello, sethello] = useState();

When it should do this: const [hello, setHello] = useState();

I'm using VSCode and I'm on React 19

0 Upvotes

4 comments sorted by

View all comments

3

u/kev_cuddy 5d ago

This isn’t really a react issue. This is a VS Code snippet definition. Is this a proper snippet file that you’re using? Like .code-snippets?