1.0.0 • Published 3 years ago

react-error-boundary-with-ssr-support v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

react-error-boundary-with-ssr-support

Handle SSR rendering error using error boudnary.

Installation

npm i react-error-boundary-with-ssr-support

Usages

Handling client and server rendering error

import ErrorBoundaryWithSSRSupport from 'react-error-boundary-with-ssr-support';


class App extends React.Component {
	reportErrorHandler(error, errorInfo) {
		/* Log error somewhere */
	}

	fallbackHandler() {
              /* Anythig you want to render as fallback content */
		return <div>Error Fallback</div>;
	}

	render() {
	  return (
		<>
		  <p>Hello world</p>
		  <ErrorBoundaryWithSSRSupport fallbackHandler={this.fallbackHandler} handleSSRErrors reportErrorHandler={reportErrorHandler}>
			  /* Any children/component */
		  </ErrorBoundaryWithSSRSupport>
		</>
	  );
	}
}

export default App;

Note: if you do not pass handleSSRErrors flag as true then error will not be handle on server.

1.0.0

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago