react-doctor/no-render-prop-children
Replace `renderXxx` props with compound subcomponents (e.g. `<Modal.Header>`) or `children` so the parent doesn't dictate every customization point
- Category: Architecture
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: always
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires when a single JSX opening element receives 3 or more attributes whose names match render followed by an uppercase letter (e.g. renderHeader, renderFooter, renderActions on one component). A single render prop is intentionally ignored (MUI Autocomplete's renderInput, FlatList's renderItem, react-hook-form Controller's render). Confirm the element owns this surface area rather than transparently forwarding a library API.
Fix prompt
Use this once validation confirms the diagnostic is real.
Replace the renderXxx slots with compound subcomponents that consumers freely compose (<Modal><Modal.Header>...</Modal.Header><Modal.Body>...</Modal.Body></Modal>), or accept structured children and discover slots via React.Children. Consumers no longer need to know every customization point ahead of time, and slot ordering becomes their concern. See https://kentcdodds.com/blog/compound-components-with-react-hooks
Related rules
More Architecture rules from the rules reference:
react-doctor/no-set-state: Lift state up or use an external store instead of this.setState.react-doctor/no-side-tab-border: Use a subtler accent (box-shadow inset, background gradient, or border-bottom) instead of a thick one-sided borderreact-doctor/no-unescaped-entities: Replace bare ' / " / > / } characters in JSX text with HTML entities.react-doctor/no-wide-letter-spacing: Reserve wide tracking (letter-spacing > 0.05em) for short uppercase labels, navigation items, and buttons — not body textreact-doctor/no-z-index-9999: Define a z-index scale in your design tokens (e.g. dropdown: 10, modal: 20, toast: 30). Create a new stacking context with `isolation: isolate` instead of escalating values