render-props-pattern

Share rendering logic across components using render props that return JSX.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/PMKhai/claude-config --skill render-props-pattern-pmkhai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: render-props-pattern
Source: https://github.com/PMKhai/claude-config/tree/main/skills/render-props-pattern
Command: npx skills add https://github.com/PMKhai/claude-config --skill render-props-pattern-pmkhai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Render props help you share rendering logic between components by passing a function that returns JSX, enabling flexible composition without duplicating UI code.

Core Features & Use Cases

  • Share stateful rendering behavior across components
  • Compare with alternative patterns (HOC, hooks) and choose when to use or avoid
  • Demonstrations like a Title component that delegates its rendering to a render prop or to a function supplied as children

Quick Start

Pass a function as a render prop (or as a child) to a component to render dynamic content.

Frequently Asked Questions about render-props-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share rendering logic between React components without duplicating UI code?

Use a render props pattern in React to share rendering logic by passing a function that returns JSX, enabling flexible UI composition without duplicating code across multiple components.

What is the render props pattern and how does it work for state sharing?

The render props pattern shares stateful rendering behavior by passing a function as a prop or child to a React component, which then returns dynamic JSX based on the shared data.

When should I use render props instead of higher-order components or hooks?

Use render props over higher-order components or hooks when multiple components need access to the same rendering behavior or data, requiring flexible composition without duplicating UI code.

Can I pass a function as children to render dynamic content in React?

Yes, you can pass a function as children to a component to render dynamic content, effectively using the children-as-a-function approach as an alternative to a dedicated render prop.

How do I implement a component that delegates its rendering to a render prop?

Pass a function that returns JSX directly to the component via a render prop, allowing the parent component to dictate the UI rendering while the child component manages the shared state.

Why use render props for flexible component design in React?

Render props solve the problem of sharing rendering logic between components by allowing flexible composition, ensuring stateful UI behavior is accessible without duplicating code.