Skip to content

Commit 0e0cf9e

Browse files
Fix: Render children in MySelect component to display options (#3998)
The original example did not render the **children** prop, which resulted in the **select** element not displaying the options passed as children. This PR updates the **MySelect** component to properly handle the **children** prop and render the options inside the dropdown. ### Changes Made Updated MySelect component to include the children prop inside the select element. This ensures that the options passed as children (e.g., <option> tags) are correctly displayed in the dropdown list. ### Issue Addressed Incorrect example in the documentation where options passed to the MySelect component were not being rendered. ### Testing Verified that the options now render correctly in the MySelect component by testing it with the provided example from the tutorial. ### Additional Notes This PR only fixes the example in the docs and does not introduce any breaking changes.
1 parent 2618cc4 commit 0e0cf9e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: docs/tutorial.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -849,12 +849,13 @@ const MyCheckbox = ({ children, ...props }) => {
849849
);
850850
};
851851

852-
const MySelect = ({ label, ...props }) => {
852+
const MySelect = ({children, label, ...props }) => {
853853
const [field, meta] = useField(props);
854854
return (
855855
<div>
856856
<label htmlFor={props.id || props.name}>{label}</label>
857857
<select {...field} {...props} />
858+
{children}
858859
{meta.touched && meta.error ? (
859860
<div className="error">{meta.error}</div>
860861
) : null}

0 commit comments

Comments
 (0)