Skip to content

Add React snippets packaage #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions packages/react-snippets/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# React Snippets for Espanso

A collection of time-saving text expansions for React developers. This package includes snippets for:

- Common imports
- Functional and class components
- React Hooks (useState, useEffect, useRef, useCallback, useMemo, useReducer)
- Context API
- React Router
- JSX Fragments
- Error Boundaries
- Form handling

## Installation

```
espanso install react-snippets
```

## Available Snippets

### Imports and Components

| Trigger | Description |
| ---------- | --------------------------- |
| `:rimport` | Basic React import |
| `:rfc` | Create functional component |
| `:rcc` | Create class component |

### Hooks

| Trigger | Description |
| ------------ | ------------------------------------ |
| `:rstate` | useState hook |
| `:reffect` | useEffect hook with cleanup function |
| `:rref` | useRef hook |
| `:rcallback` | useCallback hook |
| `:rmemo` | useMemo hook |
| `:rreducer` | useReducer hook with example |

### Component Features

| Trigger | Description |
| ----------- | ---------------------------- |
| `:rprop` | PropTypes declaration |
| `:rcontext` | Create Context with Provider |
| `:rroute` | React Router route |
| `:rfrag` | React Fragment shorthand |
| `:rerror` | Error Boundary component |
| `:rform` | Form handling with useState |

## Contributing

Feel free to contribute to this package by submitting pull requests or issues to the repository.
Empty file.
Empty file.