0.2.33 • Published 2 years ago
@gandalfeng/connect v0.2.33
Connect
Connect is a drop-in modal that will speak to Watson & enable us to easily guide a user through the Spotify sign in process.
Initialization
import type { AppProps } from 'next/app';
import { GandalfConnectProvider } from '../context';
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<GandalfConnectProvider>
<Component {...pageProps} />
</GandalfConnectProvider>
</>
);
}
Usage
import { useGandalfConnect } from '../context';
const Connect = () => {
const { state, setGandalfConnectConfig, toggleModal } = useGandalfConnect();
useEffect(() => {
setGandalfConnectConfig({ publicKey: 'pk_test_123', platform: 'spotify' });
}, [setGandalfConnectConfig]);
return (
<>
<button onClick={() => toggleModal()}>
another thing: {state.response}
</button>
</>
);
};