unable add required attribute to a ReactJS input component

Viewed 6611

I am attempting to add a required attribute to a react input component:

export default function UiInput() {
   render() {
   return (
    <input
     {...customAttributes}
     size={size ? size : null}
     value={inputValue}
     maxLength={maxLength}
     required={required}
    />
   )

and when I am calling my component like so,

<UiInput 
   required={required}
  />

I am not getting the red asterisk to render - not getting any errors when I pass in required to an input component, but no red asterisk is showing up, how can I make sure the asterisk renders for required inputs? Does ReactJS not support this?

1 Answers
Related