I am trying to make a template for React useState:
const [item, setItem] = useState('value')
const [$state$, set$state$] = useState($init$);$end$
Since item
is the same, only with a capital I, is it possible to auto-capitalize the first letter?
I am doing it in VS Code like this:
const [$1, set${1/(.*)/${1:/capitalize}/}] = useState($2)
Create a second variable whose value depends on the first one.
For example, $state_
has its value initialized to capitalize(state)
in the edit variables dialog
const [item, setItem] = useState('value')
const [$state$, set$state_$] = useState($init$);$end$