How to create a wrapper react-select component
21 February 2026 (Updated 21 February 2026)
import ReactSelect from 'react-select'
import StateManagedSelect from 'react-select'
// A wrapper around react-select's default <Select /> component with some
// app-specific defaults.
const Select: StateManagedSelect = (props) => {
return (
<ReactSelect
menuPortalTarget={document.body}
menuPosition="fixed"
{...props}
/>
)
}
export default Select
Now, you can use your custom <Select /> component instead of the one from react-select whenever you want your default props to apply.
Tagged:
React tooling