Importing basic form component (React)

PHOTO EMBED

Tue Dec 26 2023 20:18:23 GMT+0000 (Coordinated Universal Time)

Saved by @Marcelluki

// InfoForm.js

import React from "react";
import "./InfoForm.css";

class InfoForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      submitted: false,
    };
  }

  handleSubmit = () => {
    this.setState({ submitted: true });
  };

  render() {
    if (this.state.submitted) {
      return (
        <p className="infoForm-text">
          Thanks. When the kingdom of comfort opens, we'll be in touch!
        </p>
      );
    } else {
      return (
        <div className="infoForm-container">
          <p className="infoForm-text">
            Sign up below and we'll let you know when we launch the next great
            mattress experience!
          </p>
          <form onSubmit={this.handleSubmit} className="infoForm-form">
            <input
              className="infoForm-input"
              type="email"
              placeholder={"Enter your email here"}
            />
            <button className="infoForm-button" type="submit">
              Amaze me!
            </button>
          </form>
        </div>
      );
    }
  }
}

export default InfoForm;
content_copyCOPY

https://tripleten.com/trainer/web/lesson/c1f7540a-c695-4912-b5f1-ec8b601257f5/task/57b0a0e5-2f34-4eb6-bc1d-3a747e58b05d/