Closed Tojaeung closed 2 years ago
You've got two variables with the name register
in this file:
import { register } from '../redux/requests/authRequests';
and:
const {
register,
handleSubmit,
formState: { errors },
watch,
} = useForm<IFormInputType>();
The register
function from the useForm
hook is the one in the current scope, so that's what the name register
is referring to, and you can't dispatch that.
You'll need to make these two variables have different names somehow to avoid the name clash problem.
Hah, it's okay :) FYI the Reactiflux Discord is a good place to ask these kinds of questions.
Dear respectful teachers Hello, I like what you made. First, I pay my respects to you. I am developing using MERN stack. (win10, vsCode) I use a library called react-hook-form to verify user data in frontEnd. https://github.com/Tojaeung/web-socials-portpolio/blob/master/client/src/pages/Register.tsx The link above is my GitHub address where the problem occurred. path : client/src/pages/Register.tsx(27 line).
What's the problem? I tried to solve this problem, but I couldn't. The login component(path : client/src/pages/Login.tsx.) did not use react-hook-form. But createAsyncThunk works well. When used with react-hook-form, createAsyncThunk does not work. Can respected teachers solve this problem? I'd appreciate it if you could help me.