Google signin λ²νΌμ΄ λ λλ§μ΄ μλμ΄ νμκ°μ νμ΄μ§κ° κ²μνλ©΄μΌλ‘ λμ€λ μ΄μ λ°μ
google script λ΄λΆμμ μ½λκ° λ³κ²½λμλμ§ μ μμ μΌλ‘ μλνκ³ μλ μ½λμ λ¬Έμ κ° μ겨μ μμνλ€.
console

GoogleLogin.tsx
const GoogleLogin = () => {
const googleElId = 'google-login-api'
const googleElRef = useRef<HTMLButtonElement | null>(null)
// μ½μ μ°½μμλ Refμμ μ€λ₯κ° λ¬λ€κ³ νμ§λ§ λλ²κΉ
ν΄λ³΄λ λ¬Έμ λ μλ μν
const load = useAtomValue(googleScriptAtom)
useInitGoogle() // initialize hook
useEffect(() => {
if (!load || !window.google) return
const parent = document.querySelector<HTMLDivElement>(`#${googleElId}`)
window.google.accounts.id.renderButton(parent, {
width: '360',
click_listener() {
googleElRef.current?.focus()
},
})
}, [load])
if (!load) return null
return (
<Button btnRef={googleElRef}>
<div id={googleElId} />
<GoogleIcon />
Continue with Google
</Button>
)
}
κ°λ¨ν μ»΄ν¬λνΈλΌ 첫 μ€λΆν° μ½μμ μ°μ΄λ³΄λ©΄μ λλ²κΉ ν΄λ³΄μλ€.
renderButton μμ μλ¬κ° λ°μν κ²μ νμΈνλλ°,
window.google.accounts.id.renderButton(parent, {
width: '360',
click_listener() {
googleElRef.current?.focus()
},
})
source νμμ νμΈν΄λ³΄λ widthκ° λ¬Έμ μλ€.

Google Authentication 곡μ λ¬Έμ λ λ°λκ² μμλλ°..? 
λ¨μκ° μμ΄μ κ°μ΄ μ λλ‘ λ€μ΄κ°μ§ μλ κ±΄κ° μΆμ΄μ '360' β '360px'λ‘ μμ ν ν μ μ μλνλ κ²μ νμΈνλ€.
ν .. string νμ
μΈλ° μ μ© μμλ number νμ
μ΄λ€? β360βμ΄ μλλΌ 360μΌλ‘ κ°μ΄ λ€μ΄κ°μΌ νλ?
numberλ‘ λ³κ²½νλ μ΄κ²λ μ λλ‘ μλνλ€.
π§Β λ¬Έμκ° κ΅μ₯ν ν·κ°λ¦¬λ λ―
βnumberβ β Xnumber β Oβnumber + unitβ β O
μ λ¦¬κ° μ λ κΈμ΄λ€μ. λμμ΄ λμ΅λλ€.