
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-liff
Advanced tools
A react context provider for LIFF (LINE Front-end Framework)
Create your React application development environment.
npx create-react-app app-name
Add react-liff
to your app dependencies.
npm i --save @line/liff react-liff
# or
yarn add @line/liff react-liff
Import react-liff
to your app and use it!
An example of src/App.js
import React, { useEffect, useState } from 'react';
import { useLiff } from 'react-liff';
import './App.css';
const App = () => {
const [displayName, setDisplayName] = useState('');
const { error, isLoggedIn, isReady, liff } = useLiff();
useEffect(() => {
if (!isLoggedIn) return;
(async () => {
const profile = await liff.getProfile();
setDisplayName(profile.displayName);
})();
}, [liff, isLoggedIn]);
const showDisplayName = () => {
if (error) return <p>Something is wrong.</p>;
if (!isReady) return <p>Loading...</p>;
if (!isLoggedIn) {
return (
<button className="App-button" onClick={liff.login}>
Login
</button>
);
}
return (
<>
<p>Welcome to the react-liff demo app, {displayName}!</p>
<button className="App-button" onClick={liff.logout}>
Logout
</button>
</>
);
};
return (
<div className="App">
<header className="App-header">{showDisplayName()}</header>
</div>
);
};
export default App;
An example of src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { LiffProvider } from 'react-liff';
import './index.css';
import App from './App';
const liffId = process.env.REACT_APP_LINE_LIFF_ID;
ReactDOM.render(
<React.StrictMode>
<LiffProvider liffId={liffId}>
<App />
</LiffProvider>
</React.StrictMode>,
document.getElementById('root')
);
npx create-react-app app-name
react-liff
to your app dependencies.
npm i --save react-liff
# or
yarn add react-liff
index.html
to load LIFF SDK
+ <script defer charset="utf-8" src="https://static.line-scdn.net/liff/edge/2/sdk.js"></script>
react-liff
to your app and use it!liffId
: string
, required
withLoginOnExternalBrowser
: boolean
, optional
liff.init()
. https://developers.line.biz/en/reference/liff/#initialize-liff-app-argumentsplugins
: Array<LiffPlugin | [LiffPlugin, LiffPluginOption]>
, optional
[pluginInstance, pluginOption]
.callback
: (liff: Liff) => Promise<void>
, optional
liff.init()
has been succeeded.error
: unknown
(is LiffError | undefined
in many cases)
liff.init()
was failed.isLoggedIn
: boolean
isReady
: boolean
true
after liff.init()
has successfully completed. Otherwise, returns false
.liff
: Liff
FAQs
A react context provider for LIFF (LINE Front-end Framework)
The npm package react-liff receives a total of 152 weekly downloads. As such, react-liff popularity was classified as not popular.
We found that react-liff demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.