Skip to content

How to hide a input field? #54

Answered by ivan-dalmet
lilyntalmers asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @lilyntalmers
You can create a FieldHidden like this :)

Field

const FieldHidden = (props) => {
  const {
    id,
    value,
  } = useField(props)

  return (
      <input
        id={id}
        type="hidden"
        value={value || ''}
      />
  );
}

Usage

<FieldHidden name="my-hidden-value" defaultValue="Something" />

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@lilyntalmers
Comment options

@ivan-dalmet
Comment options

@lilyntalmers
Comment options

Answer selected by lilyntalmers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants