From f6970c99eed2a90452f36b1ed6e24b883f0bc4a6 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sun, 12 Apr 2020 00:02:01 +0300 Subject: [PATCH] ManageCoursePage - handleChange function --- src/components/courses/ManageCoursePage.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/courses/ManageCoursePage.js b/src/components/courses/ManageCoursePage.js index 455eb97..723b710 100644 --- a/src/components/courses/ManageCoursePage.js +++ b/src/components/courses/ManageCoursePage.js @@ -25,7 +25,22 @@ function ManageCoursePage({ courses, authors, actions, ...props }) { } }, []); - return ; + function handleChange(event) { + const { name, value } = event.target; + setCourse((prevCourse) => ({ + ...prevCourse, + [name]: name === "authorId" ? parseInt(value, 10) : value + })); + } + + return ( + + ); } ManageCoursePage.propTypes = {