SolidJS Code Snippets
This is a collection of code snippets for Solid.js, a declarative JavaScript library for building user interfaces.
Snippets
Basic Reactivity
Title |
Prefix |
Description |
createSignal |
sscsig |
Create a signal |
createEffect |
ssceff |
Create a reactive effect |
createMemo |
sscemo |
Create a memoized value |
createResource |
sscrsrc |
Create a resource |
Lifecycles
Title |
Prefix |
Description |
onMount |
ssomnt |
Lifecycle hook: on mount |
onCleanup |
ssocln |
Lifecycle hook: on cleanup |
Reactive Utilities
Title |
Prefix |
Description |
untrack |
ssutrck |
Untrack a reactive context |
batch |
ssbatch |
Batch updates |
on |
ssron |
Listen to an event |
catchError |
ssctch |
Catch errors in a reactive context |
onError |
ssonerr |
Handle errors in a reactive context |
createRoot |
sscrroot |
Create a root component |
getOwner |
ssgownr |
Get the owner component |
runWithOwner |
ssrwo |
Run with a specific owner |
mergeProps |
ssmrge |
Merge props from multiple sources |
splitProps |
sssplit |
Split props for composition |
useTransition |
ssutrans |
Use transitions for concurrent updates |
startTransition |
ssstrans |
Start a concurrent update transition |
observable |
ssobsv |
Create an observable |
from |
ssfrom |
Convert to an observable |
mapArray |
ssmaparr |
Map an array of observables |
indexArray |
ssindarr |
Index an array of observables |
Usage
- Install the extension in Visual Studio Code.
- Open a Solid.js file.
- Type the snippet prefix and select the desired snippet from the autocomplete suggestions.
License
This extension is released under the MIT License. Feel free to modify and use it to improve your Solid.js development workflow.
Enjoy!
| |