A React component that displays error messages.
npm
npm install @ouroboros/react-errors
import Errors, { addError } from '@ouroboros/react-errors';
function SomeComponent(props) {
return (
<div>
<button onClick={() => addError('Test Error!')}>Add Error</button>
</div>
);
}
function App(props) {
return (
<SomeComponent />
<Errors />
);
}
Name | Type | Required | Description |
---|---|---|---|
position | "bottom" | "top" | no | Default, "bottom" |
The addError
function takes a string, or an object. In the case of an object the data will be JSON stringified and then displayed in a PRE elemenent to maintain the structure.
You can set your own styles using the #oc_errors ID, or import / include node_modules/@ouroboros/react-errors/style.css
.