-
Notifications
You must be signed in to change notification settings - Fork 843
Bret/update quickstart line marks #2720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
fc57b56
a724883
09e4450
1c7c096
a7481da
4a805cd
1b83e68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,21 +153,47 @@ This tutorial will demonstrate how to create a new React app using Vite and add | |
- [`<UserButton />`](/docs/reference/components/user/user-button): Shows the signed-in user's avatar. Selecting it opens a dropdown menu with account management options. | ||
- [`<SignInButton />`](/docs/reference/components/unstyled/sign-in-button): An unstyled component that links to the sign-in page. In this example, since no props or [environment variables](/docs/guides/development/clerk-environment-variables) are set for the sign-in URL, this component links to the [Account Portal sign-in page](/docs/guides/customizing-clerk/account-portal#sign-in). | ||
|
||
```tsx {{ filename: 'src/App.tsx', mark: [1, [6, 11]] }} | ||
```tsx {{ filename: 'src/App.tsx', mark: [2, [12, 19]], fold: [[3, 6], [21, 40]] }} | ||
import { useState } from 'react' | ||
import { SignedIn, SignedOut, SignInButton, UserButton } from '@clerk/clerk-react' | ||
import reactLogo from './assets/react.svg' | ||
import viteLogo from '/vite.svg' | ||
import './App.css' | ||
|
||
function App() { | ||
const [count, setCount] = useState(0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cont] Is |
||
|
||
export default function App() { | ||
return ( | ||
<header> | ||
<SignedOut> | ||
<SignInButton /> | ||
</SignedOut> | ||
<SignedIn> | ||
<UserButton /> | ||
</SignedIn> | ||
</header> | ||
<> | ||
<header> | ||
<SignedOut> | ||
<SignInButton /> | ||
</SignedOut> | ||
<SignedIn> | ||
<UserButton /> | ||
</SignedIn> | ||
</header> | ||
<div> | ||
<a href="https://vite.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs">Click on the Vite and React logos to learn more</p> | ||
</> | ||
Comment on lines
+177
to
+192
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add all of this tho? Think we want to keep the snippet as straightforward as possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Answered in the below comments because I think I'm making certain assumptions that I shouldn't 😅 |
||
) | ||
} | ||
|
||
export default App | ||
``` | ||
|
||
## Create your first user | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment with these imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that keeping snippets straightforward is ideal. I've also noticed that many of the quickstart guides include the rest of the generated file from the `npx create-[...]-app" results in the snippet, and then fold them, as I've done here.
Where exactly should I draw the line between "make sure this snippet is representative of the generated file" and "remove anything irrelevant from the generated file"?
For example, is persisting the template's React & Vite logos necessary?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair. I think this one is particularly flagrant to me because of the
count
code that is irrelevant to the rest of the code compared to other setup code in other SDKs. IMO, keeping the imports at the start would be fine, but I don't think we need all the code related to thecount
stuff.A user experience is usually to copy the snippet and paste that into the file, which then removes the initial code anyway. So to me, that makes sense. I'd be keen to hear @alexisintech thoughts on this actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think adding syntax highlighting is fine, but let's not add anything else to the quickstart