({ children })
| 10 | import React, { useState, useEffect } from 'react'; |
| 11 | |
| 12 | function ErrorBoundary({ children }) { |
| 13 | const [error, setError] = useState(null); |
| 14 | const handleError = () => { |
| 15 | setError('Something went wrong!'); |
| 16 | }; |
| 17 | |
| 18 | return ( |
| 19 | <> |
| 20 | {error ? ( |
| 21 | <div>Error: {error}</div> // Fallback UI |
| 22 | ) : ( |
| 23 | children |
| 24 | )} |
| 25 | </> |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | function ChildComponent() { |
| 30 | useEffect(() => { |
nothing calls this directly
no outgoing calls
no test coverage detected