Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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)
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.