// src/config.js
export const API = "http://localhost:8000/api";

Install axios

npm i axios
// Register.js
import axios from "axios";
import { API } from "../config";

  const handleSubmit = async (e) => {
    e.preventDefault();
    try {
      // console.log(email, password);
      const { data } = await axios.post(`${API}/pre-register`, {
        email,
        password,
      });
      console.log(data);
    } catch (err) {
      console.log(err);
    }
  };