mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-21 19:31:57 +00:00
Update code formatting on useTransition.md
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1544,9 +1544,10 @@ function AddCommentButton() {
|
||||
// so error gets thrown
|
||||
addComment();
|
||||
});
|
||||
}}>
|
||||
Add comment
|
||||
</button>
|
||||
}}
|
||||
>
|
||||
Add comment
|
||||
</button>
|
||||
);
|
||||
}
|
||||
```
|
||||
@@ -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";
|
||||
|
||||
// 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 />
|
||||
|
||||
Reference in New Issue
Block a user