vercel-react-native-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
Install
npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-react-native-skills- title
- Hoist Intl Formatter Creation
- impact
- LOW-MEDIUM
- impactDescription
- avoids expensive object recreation
- tags
- javascript, intl, optimization, memoization
Hoist Intl Formatter Creation
Don't create Intl.DateTimeFormat, Intl.NumberFormat, or
Intl.RelativeTimeFormat inside render or loops. These are expensive to
instantiate. Hoist to module scope when the locale/options are static.
Incorrect (new formatter every render):
Correct (hoisted to module scope):
For dynamic locales, memoize:
Common formatters to hoist:
Creating Intl objects is significantly more expensive than RegExp or plain
objects—each instantiation parses locale data and builds internal lookup tables.