Untitled

 avatar
unknown
plain_text
2 years ago
775 B
4
Indexable
import { sendToBackground } from '@plasmohq/messaging';
import React, { useState, useEffect } from 'react';

function IndexPopup() {
  const [response, setResponse] = useState("");

  useEffect(() => {
    async function fetchData() {
      const result = await sendToBackground({name:"current_user",body:{id:123},extensionId:"cnmimiohhcoajnfhehehahlkpdgjhmbe"}); // Replace this with your async function
      setResponse(result);
    }

    fetchData();
  }, [response]);

  return (
    <div
      style={{
        padding: 16
      }}>
      <h2>
        Welcome to your {response}
      </h2>
      Extension!
      <a href="https://docs.plasmo.com" target="_blank">
        View Docs
      </a>
    </div>
  )
}

export default IndexPopup
Editor is loading...
Leave a Comment