Debian Codegraph @

examples/react-spa/frontend/src/components/FormErrors.js

raw
1 export default function FormErrors (props) {
2 if (!props.errors || !props.errors.length) {
3 return null
4 }
5 const errors = props.errors.filter(error => (props.param ? error.param === props.param : error.param == null))
6 if (!errors.length) {
7 return null
8 }
9 return <ul style={{ color: 'darkred' }}>{errors.map((e, i) => <li key={i}>{e.message}</li>)}</ul>
10 }