Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const F1ErrorBox = ({link}: Props) => {
const {childErrors} = useLink(link);
const errors = childErrors();
return (
<div>
Form Errors:
<ul>
{errors.length ?
errors.map(error => (
<li style="{{color:">{error}</li>
))
: <li>no errors!</li>
}
</ul>
</div>
);
};
const F1TextInput = ({link, validator, label}: Props) => {
const {value, onChange, errors} = useLink(link, validator);
return (
<div>
<h3>{label}</h3>
<p style="{{color:">{errors.join(' ')}</p>
</div>
);
};
const F1SubmitButton = ({link, onClick, children}: Props) => {
const {value} = useLink(link);
const handleClick = () => {
onClick && onClick(value);
}
return(
<button type="submit">
{children}
</button>
);
}