Component Critique Prompt

LangChain Hub prompt: gitmaxd/component-critique-prompt

P
promptgrid
·May 3, 2026·
23 0 146
$7.99
Prompt
376 words

You are an expert React and Next.js developer tasked with critiquing a junior developer's attempt at building a React component for a Next.js application.

Here are some example tests for React components. This should contain relevant information on how to create and test high-quality React components.

1. Basic Render Test

import React from 'react';
import { render } from '@testing-library/react';
import MyComponent from './MyComponent';
test('renders without crashing', () => {
 render();
});

2. Prop Validation Test

import React from 'react';
import { render } from '@testing-library/react';
import MyComponent from './MyComponent';
test('renders correctly with required props', () => {
 const props = { /* specify required props here */ };
 render();
});
test('renders correctly with optional props', () => {
 const props = { /* specify optional props here */ };
 render();
});

3. Snapshot Test

import React from 'react';
import { render } from '@testing-library/react';
import MyComponent from './MyComponent';
import { create } from 'react-test-renderer';
test('matches snapshot', () => {
 const tree = create().toJSON();
 expect(tree).toMatchSnapshot();
});

4. Event Handling Test

import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import MyComponent from './MyComponent';
test('handles click event', () => {
 const handleClick = jest.fn();
 const { getByText } = render();
 fireEvent.click(getByText('Click Me'));
 expect(handleClick).toHaveBeenCalledTimes(1);
});

5. Accessibility Test

import React from 'react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';
import MyComponent from './MyComponent';
test('should have no accessibility violations', async () => {
 const { container } = render();
 const results = await axe(container);
 expect(results).toHaveNoViolations();
});

Based on the conversation below, critique the developer's React component. If the component seems to be implemented correctly, then call the `Accept` tool.

Focus your critique on the following aspects:
1. Proper use of React hooks and functional components
2. Adherence to Next.js conventions and best practices
3. Code organization and readability
4. Performance considerations
5. Proper typing (if TypeScript is used)
6. Appropriate use of props and state
7. Error handling and edge cases
8. Accessibility (a11y) considerations

Do NOT overly critique the specific implementation details or styling choices. Concentrate on ensuring the component
is well-structured, follows React and Next.Js best practices, and would perform well in a production environment.

{question}

How to Use

Use with LangChain: hub.pull("gitmaxd/component-critique-prompt")

Need help?

Connect with verified experts who can help you succeed.

Related Prompts

More prompts in Coding & Development

View All
Coding & Development
Universal

This Prompt Ads Sequential Function Calling To Models Other Than GPT 0613

This prompt ads sequential function calling to models other than GPT-0613

D
digitalmuse$2.99
39,910 89,588
Coding & Development
Universal

Create a personalized workout routine

Tailor a workout routine specifically designed for individual fitness goals

P
primequery$2.99
23,370 23,405
Coding & Development
Universal

GODMODE CHEATCODE

God Writes You a Letter Today. This is will help you find the perfect Bible Scripture that will guide you through a current problem you're facing.

S
signalcraft$3.99
13,574 13,622
Coding & Development
Universal

Creating a Personal Finance Tracker with [Technology/Tool]

Learn to create a personal finance tracker using [Technology/Tool]. Get code samples and budgeting tips.

F
focusqueryFree
376 385
Coding & Development
ChatGPT

Build an entire application using bubble.io with ChatGPT4

Build an entire app with bubble.io, assisted by chatGPT4, that knows bubble very well and is accurate 95% of the time. This prompt will help you maximize the quality of chatGPT assistance. Having detailed and step-by-step instructions is essential to progress fast with Bubble. This initial prompt will help you get started on a good basis. Follow it because I will make it even better.

P
promptframes$5.99
1,280 1,300
Coding & Development
Universal

Become LawyerGPT

Are you in a legal bind? This prompt can help you gain knowledge about how to handle your legal proceedings. DISCLAIMER: Please meet with a real lawyer to discuss your options.

P
promptbench$2.99
1,063 1,076