mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-29 14:38:50 +02:00
feat(core): Add React ErrorBoundary component + theme default boundaries (#3104)
Co-authored-by: Paden Clayton <paden.clayton@monkedia.com> Co-authored-by: Josh-Cena <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
4922764095
commit
fa6d15b35f
34 changed files with 317 additions and 11 deletions
16
website/src/components/ErrorBoundaryTestButton/index.tsx
Normal file
16
website/src/components/ErrorBoundaryTestButton/index.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React, {useState} from 'react';
|
||||
|
||||
export default function ErrorBoundaryTestButton({children = 'Boom!'}) {
|
||||
const [state, setState] = useState(false);
|
||||
if (state) {
|
||||
throw new Error('Boom!');
|
||||
}
|
||||
return <button onClick={() => setState(true)}>{children}</button>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue