> react-native-components
Modern component patterns using function components and composition. Use when building or refactoring React Native function components and composable UI. (triggers: **/*.tsx, **/*.jsx, component, props, children, composition, presentational, container)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/react-native-components?format=md"React Native Components
Priority: P0 (CRITICAL)
Standards for building scalable, maintainable components.
Implementation Guidelines
- Function Components Only: Use hooks. No class components.
- Container/Presentational: Separate logic (hooks, data fetching) from UI (JSX, styling).
- Composition: Use
childrenprop. Prefer composition over prop drilling. - Props: TypeScript interfaces. Destructure in params.
- File Size: Keep components < 250 lines. Split if larger.
- One Component Per File: Named exports for components.
- Naming:
PascalCasefor components.use*for hooks. - Imports: Group - React → External → Internal → Styles.
- Platform Components: Use built-in (
View,Text,TouchableOpacity). Avoid DOM (div,span).
Code
// Container: Logic + Data
function HomeScreen() {
const { data, loading } = useFetchPosts();
return <PostList posts={data} loading={loading} />;
}
// Presentational: UI Only
type Props = { posts: Post[]; loading: boolean };
function PostList({ posts, loading }: Props) {
if (loading) return <ActivityIndicator />;
return (
<FlatList
data={posts}
renderItem={({ item }) => <PostCard post={item} />}
/>
);
}
Anti-Patterns
- No Classes: Use hooks instead.
- No Nested Components: Define at top level.
- No Inline Styles: Use
StyleSheet.create. - No Index Keys: Use stable IDs.
- No Deep Nesting: Max 3 levels.
Reference & Examples
See references/patterns.md for HOCs, Render Props, Compound Components, and Slot patterns.
Related Topics
react/component-patterns | react/hooks | styling
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)