Component Props Generate Prompt

LangChain Hub prompt: ethanou/component_props_generate_prompt

I
instructionset
·May 3, 2026·
40 0 14
$6.99
Prompt
338 words

You will be given a React component code and a new component name. Your task is to identify hard-coded text in the component, extract it as input attributes, update the component name, and rewrite the code in TypeScript. Follow these steps carefully:

  1. First, you will receive the React component code:

{REACT_COMPONENT}

  1. You will also receive the new component name:

{NEW_COMPONENT_NAME}

  1. Identify all hard-coded text content within the component. This includes any string literals that are not already passed as props or part of JSX attributes. Pay attention to text within JSX elements, default values for variables, and any other string constants.

  2. For each piece of hard-coded text you identified, create a new prop in the component's props interface. The prop name should be descriptive and follow camelCase convention. For example, if you find a hard-coded title "Welcome to My App", you might create a prop called "welcomeTitle".

  3. Replace all instances of hard-coded text in the component with references to the newly created props. Use the prop names you defined in step 4.

  4. Update the component name to the new name provided in tags. Ensure you update both the function name and any references to the component within the code.

  5. Rewrite the entire component in TypeScript. This involves:

    • Adding type annotations for props, state, and any other variables
    • Using interfaces or type aliases to define the shape of objects
    • Adding return types to functions
    • Ensuring all event handlers have proper TypeScript types
    • Only use serializable type as the props fields types, do not use any React ComponentType or ElementType
  6. Format your final output as follows:

    // Your TypeScript code here

  7. After the updated component, list the new props you've created along with their types and descriptions using tags. Format each prop as follows: propName: PropType - Description

Make sure your final output is a fully functional TypeScript React component with all hard-coded text extracted as props, the component name updated, and proper TypeScript annotations added.

How to Use

Use with LangChain: hub.pull("ethanou/component_props_generate_prompt")

Need help?

Connect with verified experts who can help you succeed.

Related Prompts

More prompts in Writing & Content

View All
Writing & Content
ChatGPTGeminiPerplexity

Human Written |100% Unique |SEO Optimised Article

Human Written | Plagiarism Free | SEO Optimized Long-Form Article + Outline & Real-Time Web Search

P
promptpilot$6.99
12,073,403 16,889,444
Writing & Content
Universal

Fully SEO Optimized Article including FAQ's (2.0)

Create a 100% Unique and SEO Optimized Article | Plagiarism Free Content with | Title | Meta Description | Headings with Proper H1-H6 Tags | up to 2500+ Words Article with FAQs, and Conclusion.

L
lexiconlabs$4.99
3,425,569 4,789,844
Writing & Content
Universal

Write Best Article to rank on Google

Write Best Smart Article Best to rank no 1 on Google by just writing Title for required Post. If you like the results then please hit like button.

P
promptedge$4.99
2,970,263 4,089,236
Writing & Content
Universal

one click ebook for kids

create an ebook for a childs growth for example rhyme for kids

P
promptwerkzFree
2,114 2,135
Writing & Content
Universal

Yoast SEO Optimized Content Writer

Write detail YoastSEO optimized article by just putting blog title. I need 5 more upvotes so that I can create more prompts. Hit upvote(Like) button.

A
axiomprompts$2.99
1,155,124 2,099,270
Writing & Content
Universal

TopG Cheat Code

This is the TopG CheatCode for ChatGPT 4. Find a long format video on Youtube, copy the link and paste here, then have ChatGPT 4 do the work. For the full tutorial please ATTENTION: For this to work properly you will need to have the following plugin installed: ChatGPT4 Plugin - VideoSummary - Please watch full tutorial if you have any questions - instagram.com/digitaljeff

A
airunner_co$1.99
10,273 10,312