mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 02:08:55 +02:00
docs: create Docusaurus v2.4.0 release docs + changelog + release blog post (#8811)
This commit is contained in:
parent
da9f86409d
commit
97caab16d4
105 changed files with 19157 additions and 22 deletions
|
@ -9,15 +9,24 @@ import React, {type ReactNode, useState} from 'react';
|
|||
|
||||
export default function ErrorBoundaryTestButton({
|
||||
children = 'Boom!',
|
||||
message = 'Boom!\nSomething bad happened, but you can try again!',
|
||||
cause,
|
||||
}: {
|
||||
children?: ReactNode;
|
||||
message?: string;
|
||||
cause?: string;
|
||||
}): JSX.Element {
|
||||
const [state, setState] = useState(false);
|
||||
if (state) {
|
||||
throw new Error('Boom!\nSomething bad happened, but you can try again!');
|
||||
throw new Error(message, {
|
||||
cause: cause ? new Error(cause) : undefined,
|
||||
});
|
||||
}
|
||||
return (
|
||||
<button type="button" onClick={() => setState(true)}>
|
||||
<button
|
||||
className="button button--danger"
|
||||
type="button"
|
||||
onClick={() => setState(true)}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue