简体   繁体   中英

I used the styled-components component, and I want to display a button next to it when the Input gets the focus, but it doesn’t work

This is my code, can some one help me

I used the styled-components component, and I want to display a button next to it when the Input gets the focus, but it doesn't work.

I think changing InputContainer's type to input is good option...

const InputContainer = styled.input`
  ...
  &:focus + ${CancelButton} {
    display: block;
  }
`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM