Toolverse
All skills

js-hoist-regexp

by TheOrcDev

Hoist RegExp creation outside render or memoize with useMemo(). Apply when using regular expressions in React components or frequently called functions.

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Author
TheOrcDev
Category
Frontend
Views
1

About this skill

Hoist RegExp creation outside render or memoize with useMemo(). Apply when using regular expressions in React components or frequently called functions.

How to use

  1. Zidentyfikuj miejsca w komponentach React, gdzie tworzysz nowe wyrażenia regularne wewnątrz funkcji renderującej lub w funkcjach wywoływanych wielokrotnie — każde utworzenie nowego RegExp zużywa pamięć i spowalnia aplikację.
  2. Jeśli wyrażenie regularne jest statyczne (nie zależy od props lub state), przenieś je na poziom modułu, poza komponent — zdefiniuj je jako stałą na górze pliku, np. const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.
  3. Jeśli wyrażenie regularne zależy od dynamicznych wartości (np. query z props), opakuj jego tworzenie w hook useMemo() z odpowiednią tablicą zależności — to zapewni, że RegExp zostanie przebudowany tylko gdy zmienią się jego zależności.
  4. Pamiętaj o ostrzeżeniu dotyczącym globalnych flag (/g) — mają one mutable'owy stan lastIndex, który może powodować nieoczekiwane wyniki przy wielokrotnym użyciu tego samego obiektu regex'u w pętlach lub kolejnych wywołaniach.
  5. Przetestuj komponent, aby upewnić się, że wyrażenie regularne działa poprawnie i że liczba renderowań zmniejszyła się — możesz użyć React DevTools Profiler do weryfikacji.

Related skills

theme-factory

by anthropics

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

Frontend
40139

frontend-slides

by sickn33

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual

Frontend
65135

browser-use

by browser-use

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.

Frontend
23107

2d-games

by davila7

2D game development principles. Sprites, tilemaps, physics, camera.

Frontend
2674

screenshot-to-code

by OneWave-AI

Convert UI screenshots into working HTML/CSS/React/Vue code. Detects design patterns, components, and generates responsive layouts. Use this when users provide screenshots of websites, apps, or UI designs and want code implementation.

Frontend
94209

better-icons

by better-auth

Use when working with icons in any project. Provides CLI for searching 200+ icon libraries (Iconify) and retrieving SVGs. Commands: `better-icons search u003cqueryu003e` to find icons, `better-icons get u003cidu003e` to get SVG. Also available as MCP server for AI agents.

Frontend
2037