CoursesPage update

master
Tudor Stanciu 2020-04-11 03:10:45 +03:00
parent d09fa93d90
commit c4394dd747
1 changed files with 23 additions and 1 deletions

View File

@ -1,8 +1,30 @@
import React from "react"; import React from "react";
class CoursesPage extends React.Component { class CoursesPage extends React.Component {
state = {
course: {
title: ""
}
};
handleChange = (event) => {
const course = { ...this.state.course, title: event.target.value };
this.setState({ course });
};
render() { render() {
return <h2>Courses</h2>; return (
<form>
<h2>Courses</h2>
<h3>Add Course</h3>
<input
type="text"
onChange={this.handleChange}
value={this.state.course.title}
/>
<input type="submit" value="Save" />
</form>
);
} }
} }