UNPKG

@line/create-liff-app

Version:

Start developing LIFF application with a simple CLI command.

44 lines (39 loc) 866 B
import { useEffect, useState } from "react"; import liff from "@line/liff"; import "./App.css"; function App() { const [message, setMessage] = useState(""); const [error, setError] = useState(""); useEffect(() => { liff .init({ liffId: import.meta.env.VITE_LIFF_ID }) .then(() => { setMessage("LIFF init succeeded."); }) .catch((e) => { setMessage("LIFF init failed."); setError(`${e}`); }); }); return ( <div className="App"> <h1>create-liff-app</h1> {message && <p>{message}</p>} {error && ( <p> <code>{error}</code> </p> )} <a href="https://developers.line.biz/ja/docs/liff/" target="_blank" rel="noreferrer" > LIFF Documentation </a> </div> ); } export default App;