-
I'm trying to use React Hook Form on IE11. Therefore, I added the import statements shown below, and this code worked fine. App.jsimport 'react-app-polyfill/ie11'; // addition
import 'core-js/stable/object/values'; // addition
import 'core-js/stable/object/entries'; // addition
import React from 'react';
import ReactDOM from 'react-dom';
import { useForm } from 'react-hook-form/dist/index.ie11';
function Form() {
const { register, formState, handleSubmit } = useForm({
mode: 'onBlur',
});
const onSubmit = (data) => {
alert(JSON.stringify(data));
};
return (
<form onSubmit={handleSubmit(onSubmit)}>
<label>Name</label>
<input type="text" name="name" ref={register({ required: true })} />
<input type="submit" disabled={!formState.isValid} value="Submit" />
</form>
);
}
function App() {
const mount = () => {
ReactDOM.render(<Form />, document.getElementById('form-area'));
};
const unmount = () => {
ReactDOM.unmountComponentAtNode(document.getElementById('form-area'));
};
return (
<div>
<button type="button" onClick={mount}>
Mount
</button>
<button type="button" onClick={unmount}>
UnMount
</button>
<div id="form-area"></div>
</div>
);
}
export default App; Could you please tell me this is correct usage or not? In addition,I tried Detected Memory leakThese screenshots were taken using the following steps.
Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
hmmm strange, ie11 build should work without other polyfills. https://github.com/react-hook-form/react-hook-form/blob/master/rollup/rollup.ie11.config.js |
Beta Was this translation helpful? Give feedback.
-
I created #2489. And merged version v6.3.1 was released. |
Beta Was this translation helpful? Give feedback.
@kwht-k
I created #2489. And merged version v6.3.1 was released.
Maybe you should use v6.3.1.