How do I display value in input field [closed]

I have a reactjs input field that is read only. How do I change the placeholder and replace it automatically with whatever result I get from an api call?


You can do something like this:

import { useEffect, useState } from "react";

export default function App() {
  const [placeholder, setPlaceholder] = useState("defaultPlaceHolder");
  useEffect(() => {
   //here is a sample of api call
   setTimeout(() => {
    }, 3000);

  }, []);
  return <input type="text" placeholder={placeholder} />;