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:
Paden Clayton 2021-11-04 10:07:32 -05:00 committed by GitHub
parent 4922764095
commit fa6d15b35f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 317 additions and 11 deletions

View 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>;
}