diff --git a/apps/docs/content/guides/auth/quickstarts/react.mdx b/apps/docs/content/guides/auth/quickstarts/react.mdx index 1f7af109800..cf86dbcaaf6 100644 --- a/apps/docs/content/guides/auth/quickstarts/react.mdx +++ b/apps/docs/content/guides/auth/quickstarts/react.mdx @@ -73,103 +73,79 @@ hideToc: true ```js src/App.js - import React, { useState } from 'react'; - import { createClient } from '@supabase/supabase-js' + import React, { useState } from 'react'; + import { createClient } from '@supabase/supabase-js' + function App() { + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [loading, setLoading] = useState(false); + const supabase = createClient('https://.supabase.co', '') - function App() { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [loading, setLoading] = useState(false); + async function signInWithEmail(e) { + e.preventDefault(); + setLoading(true); + const { error } = await supabase.auth.signInWithPassword({ email, password }); + if (error) alert(error.message); + setLoading(false); + } - const supabase = createClient('https://.supabase.co', '') + async function signUpWithEmail() { + setLoading(true); + const { data: { session }, error } = await supabase.auth.signUp({ email, password }); + if (error) alert(error.message); + if (!session) alert('Please check your inbox for email verification!'); + setLoading(false); + } - async function signInWithEmail() { - setLoading(true); - const { error } = await supabase.auth.signInWithPassword({ email, password}); - if (error) alert(error.message); - setLoading(false); - } - - async function signUpWithEmail() { - setLoading(true); - const { data: { session }, error} = await supabase.auth.signUp({ email, password}); - if (error) alert(error.message); - if (!session) alert('Please check your inbox for email verification!'); - setLoading(false); - } - - const styles = { - container: { - maxWidth: '300px', - margin: '20px auto', - padding: '20px', - }, - formGroup: { - marginBottom: '15px', - }, - label: { - display: 'block', - marginBottom: '5px', - }, - input: { - width: '100%', - padding: '8px', - marginBottom: '10px', - }, - button: { - padding: '8px 16px', - marginRight: '10px', - cursor: 'pointer', - } - }; - - return ( -
-
- -
- -
- -
- - - + return ( +
+
+
+ +
+
+ +
+ + +
); } - export default App + export default App; + ```