Skip to content
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

Update code formatting on useTransition.md #6413

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/content/reference/react/useTransition.md
Original file line number Diff line number Diff line change
Expand Up @@ -1520,15 +1520,15 @@ import { ErrorBoundary } from "react-error-boundary";
export function AddCommentContainer() {
return (
<ErrorBoundary fallback={<p>⚠️Something went wrong</p>}>
<AddCommentButton />
<AddCommentButton />
</ErrorBoundary>
);
}

function addComment(comment) {
// For demonstration purposes to show Error Boundary
if(comment == null){
throw Error('Example error')
if (comment == null) {
throw Error("Example error");
}
}

Expand All @@ -1544,9 +1544,10 @@ function AddCommentButton() {
// so error gets thrown
addComment();
});
}}>
Add comment
</button>
}}
>
Add comment
</button>
);
}
```
Expand All @@ -1563,16 +1564,16 @@ export default function App() {
// TODO: update to import from stable
// react instead of canary once the `use`
// Hook is in a stable release of React
import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './styles.css';
import React, { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./styles.css";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are double-quoting these? I'm seeing single-quotes elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what CodeSandbox does by default on save

codesandbox-double-quote-on-save.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohoo I see, do you mind if we keep it single? This is how we format code at Meta and I also see most of our docs already use single quotes. I think we need some light-weight markdown formatting to start enforcing this. I'm wondering if we can turn it on with most formatting disabled. I looked into it before but I think this might be possible


// TODO: update this example to use
// the Codesandbox Server Component
// demo environment once it is created
import App from './App';
import App from "./App";

const root = createRoot(document.getElementById('root'));
const root = createRoot(document.getElementById("root"));
root.render(
<StrictMode>
<App />
Expand Down
Loading