I came across an issue which I'm not sure is a bug or just my lack of understanding React.
The problem is that when I'm using useForm's inputProps on a TextInput inside of a component which is defined inside of another component, the input won't maintain focus and prevents me from typing into the input.
App.tsx
const form = useForm({
initialValues: {
test: '',
},
});
return (
<MantineProvider>
<div>
<h1>Hello {name}!</h1>
<p>Start editing to see some magic happen :)</p>
<Test inputProps={form.getInputProps('test')} />
</div>
</MantineProvider>
);
};```
Test.tsx
```export default function Test({ inputProps }) {
const Wrap = () => {
return <TextInput placeholder="Test..." {...inputProps} />;
};
// Doesn't work...
return <Wrap />;
// Works...
// return <TextInput placeholder="Test..." {...inputProps} />;
}```
This can be reproduced here by attempting to focus the input: https://stackblitz.com/edit/stackblitz-starters-dptysf?file=src%2FApp.tsx
To see the working version, comment out the "not working" line and uncomment the "working" line.
My expectation is that both returning `<Wrap>` as well as just returning the `<TextInput>` directly from `<Test>` would result in the same exact thing, but that doesn't appear to be the case.