In React Transition Group, enter and exit transitions occur by default. However, sometimes that may not be the required behaviour. In this lesson, let’s take a look at how to change this behaviour, using the enter
, and exit
props.
Instructor: [00:00] Here, we have a button which toggles the appearance of a menu using CSS transition from React transition group. As well as the props that we're passing so far into our CSS transition, we can also make use of the enter and exit props. These are true by default.
[00:22] If we set enter to false, then these styles that we're using for our enter transition will not apply. The same can be said for when exit is false, these styles won't apply. Let's see that in action now. Let's pass enter equals false and refresh.
[00:47] Now, we get the exit transition, but not the enter transition. If we do exit equals false, we get no transition. This could be useful for when we want to keep hold of the CSS for our transitions, but we may want to dynamically disable the transitions, should our app require it.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!