Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make react-bootstrap Alert invisible initially

I am using versions:

[email protected]
[email protected]

I am trying to create an alert that is initially invisible. According to the documentation, the show attribute is the right one to use, but it doesn't seem to be working.

These are the things I have tried, but none have work:

<Alert variant="danger" show="false">Passwords must match</Alert>
<Alert variant="danger" defaultShow="false">Passwords must match</Alert>
<Alert variant="danger" show=false>Passwords must match</Alert>
<Alert variant="danger" defaultShow=false>Passwords must match</Alert>

Any ideas would be much appreciated. Thanks a lot.

like image 379
Garet Jax Avatar asked Nov 22 '25 10:11

Garet Jax


2 Answers

You're using a string for false. Use a javascript false with braces instead:

<Alert variant="danger" show={false}>Passwords must match</Alert>
like image 170
Will Jenkins Avatar answered Nov 24 '25 01:11

Will Jenkins


Try to modify the show from a string to a boolean just like this

<Alert variant="danger" show={false}>Passwords must match</Alert>
like image 42
Achraf C. Avatar answered Nov 24 '25 00:11

Achraf C.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!