Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | export default function ErrorEvent() { const handleClick = () => { throw new Error('Error is occured in MyApp.'); }; return ( <button type="button" onClick={handleClick}> 오류 발사 </button> ); } // import { useErrorBoundary } from 'react-error-boundary'; // export default function ErrorEvent() { // const { showBoundary } = useErrorBoundary(); // const handleClick = () => { // try { // throw new Error('Error is occured in MyApp.'); // } catch(e) { // // 핸들러 내에서 발생한 예외를 Error Boundary로 넘긴다. // showBoundary(e); // } // }; // return ( // <button type="button" onClick={handleClick}> // 오류 발사 // </button> // ); // } |