import React, { useState, useEffect } from "react"; const CreatePost = (props) => { const onSubmit = (e) => { e.preventDefault(); const requestOptions = { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${localStorage.getItem("token")}`, }, body: JSON.stringify({ postid: props.id }), }; fetch(`${process.env.REACT_APP_API_ENDPOINT}/createpost`, requestOptions) .then((response) => response.json()) .then((data) => { console.log(data); }); }; return (