DEV Community

Discussion on: How to toggle Bootstrap navbar collapse button in React without jQuery

Collapse
 
dmikester1 profile image
Mike Dodge • Edited

This works to do a basic show/hide. But it doesn't give you that nice slide down and up effect that Bootstrap does. I'm on Bootstrap 5. It appears like they(Bootstrap) are adding collapsing as it's moving and that removing that class and adding show when it's done.

Collapse
 
johnotu profile image
John Otu

Bootstrap animations are powered by the JS file which we've not added in our use case. However you can implement CSS transitions and animations in React using React Transitions Group.

Substituting the appropriate class for the version of Bootstrap you are using should give the desired results.