Skip to content

benjervis/usestate

Repository files navigation

usestate VS Code Extension

VS Code Marketplace

When using the useState hook in React, the common usage pattern looks like

const [myVariable, setMyVariable] = useState();

This is very repetitive, and the camelcase means that the variable name needs to be capitalised for the set variable, which means it can't be easily copy pasted, or added with multiple cursors.

Usage

The "Insert useState line" command can be accessed from the command palette, but it's recommeded you set up a keybinding for it. Enter your variable name into the textbox (e.g. myVariable in the above example), and the properly camelcased line will be added. You may still need to import useState yourself.

About

Extension for VS Code to insert a line for a React useState hook

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published