diff --git a/tutorials/frontend/react-apollo-hooks/tutorial-site/content/apollo-client.md b/tutorials/frontend/react-apollo-hooks/tutorial-site/content/apollo-client.md index 4b9853226..5d694a4ae 100644 --- a/tutorials/frontend/react-apollo-hooks/tutorial-site/content/apollo-client.md +++ b/tutorials/frontend/react-apollo-hooks/tutorial-site/content/apollo-client.md @@ -87,10 +87,19 @@ Create the apollo client inside `App` and pass the client prop to ` { const { loading, logout } = useAuth0(); + ++ const client = useMemo(() => { ++ if (!idToken) { ++ return; ++ } ++ ++ return createApolloClient(idToken); ++ }, [idToken]); + if (loading) { return
Loading...
; } -+ const [client] = useState(createApolloClient(idToken)); + return ( +