The Prompt Library
CodingJavaScript

React Component Prompt

Generate a reusable React functional component with props and state.

Select Model:

Prompt:

Please create a reusable React functional component based on my requirements. I need a well-structured component that follows modern React best practices. COMPONENT REQUIREMENTS: - Component name: [COMPONENT NAME] - Purpose: [DESCRIBE WHAT THE COMPONENT SHOULD DO] - Props: [LIST REQUIRED AND OPTIONAL PROPS] - State: [DESCRIBE STATE MANAGEMENT NEEDS] - UI/Design: [DESCRIBE THE VISUAL APPEARANCE] - Functionality: [DESCRIBE BEHAVIORS AND INTERACTIONS] - Special requirements: [ANY ADDITIONAL NEEDS] Please provide: 1. COMPLETE COMPONENT CODE * Modern functional component using hooks * Well-structured JSX * Props with proper validation * Efficient state management * Clean, maintainable code * Proper event handling * Responsive design considerations 2. PROPS DOCUMENTATION * Description of each prop * Type information * Default values * Required vs. optional props * Prop validation 3. STATE MANAGEMENT * Appropriate use of React hooks (useState, useEffect, etc.) * Clear state initialization * Proper state updates * Side effect handling * Performance considerations 4. STYLING APPROACH * CSS approach (inline, CSS modules, styled-components, etc.) * Responsive design implementation * Theming considerations * Accessibility features 5. USAGE EXAMPLES * Basic implementation example * Examples with different prop configurations * Integration suggestions * Best practices for using the component Please ensure the component follows React best practices, is reusable, maintainable, and optimized for performance.

Related Prompts

Other prompts you might find useful

CodingJavaScript

JavaScript Function Generator

Create a custom JavaScript function with parameters and error handling.

6 models availableView details
CodingJavaScript

Debug a JavaScript Bug

Identify and fix issues in your JavaScript logic or syntax.

6 models availableView details
CodingJavaScript

Convert JavaScript to ES6+

Modernize older JavaScript code using ES6+ syntax and best practices.

6 models availableView details
CodingJavaScript

React Component Prompt

Generate a reusable React functional component with props and state.

6 models availableView details