Skip to content

Commit 3f260ec

Browse files
committed
Copy edits
1 parent 0f421de commit 3f260ec

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

src/Transition.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export const EXITING = 'exiting';
5151
* ```
5252
*
5353
* As noted the `Transition` component doesn't _do_ anything by itself to its child component.
54-
* What it does do is track transition states over time so you can adjust you
55-
* component (such as adding styles of classes) as it changes states.
54+
* What it does do is track transition states over time so you can update the
55+
* component (such as by adding styles or classes) when it changes states.
5656
*
5757
* There are 4 main states a Transition can be in:
5858
* - `ENTERING`
@@ -61,11 +61,31 @@ export const EXITING = 'exiting';
6161
* - `EXITED`
6262
*
6363
* Transition state is toggled via the `in` prop. When `true` the component begins the
64-
* "Enter" stage. During this stage, the component will shift from its current transitions state,
64+
* "Enter" stage. During this stage, the component will shift from its current transition state,
6565
* to `'entering'` for the duration of the transition and then to the `'entered'` stage once
66-
* it's complete. So in the following example: `<Transition in timeout={500} />`,
67-
* the component will immediately shift to `'entering'` and stay there for 500ms and switch to `'entered'`.
68-
* When `in` is `false` the same thing happens except the states are `'exiting'` to `'exited'`.
66+
* it's complete. Let's take the following example:
67+
*
68+
* ```jsx
69+
* state= { in: false };
70+
*
71+
* toggleEnterState = () => {
72+
* this.setState({ in: true });
73+
* }
74+
*
75+
* render() {
76+
* return (
77+
* <div>
78+
* <Transition in={this.state.in} timeout={500} />
79+
* <button onClick={this.toggleEnterState}>Click to Enter</button>
80+
* </div>
81+
* );
82+
* }
83+
* ```
84+
*
85+
* When the button is clicked the component will shift to the `'entering'` state and
86+
* stay there for 500ms (the value of `timeout`) when finally switches to `'entered'`.
87+
*
88+
* When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`.
6989
*/
7090
class Transition extends React.Component {
7191
static contextTypes = {
@@ -323,20 +343,20 @@ Transition.propTypes = {
323343
* By default the child component is mounted immediately along with
324344
* the parent `Transition` component. If you want to "lazy mount" the component on the
325345
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
326-
* mounted even on exit unless you also specify `unmountOnExit`
346+
* mounted, even on "exited", unless you also specify `unmountOnExit`.
327347
*/
328348
mountOnEnter: PropTypes.bool,
329349

330350
/**
331-
* By default the child component is mounted in the DOM after it enteres the `'exited'` state.
332-
* If you'd prefer to completely unmonut the component after it exits, set `unmountOnExit`.
351+
* By default the child component stays mounted after it reaches the `'exited'` state.
352+
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
333353
*/
334354
unmountOnExit: PropTypes.bool,
335355

336356
/**
337-
* Normally a component is not transitioned on it's initial mount. If you
338-
* want to transition on the first mount set `appear` to `true`, and the
339-
* component will enter the component.
357+
* Normally a component is not transitioned if it shown when the `<Transition>` component mounts.
358+
* If you want to transition on the first mount set `appear` to `true`, and the
359+
* component will transition in as soon as the `<Transition>` mounts.
340360
*
341361
* > Note: there are no specific "appear" states. `apprear` only an additional `enter` transition.
342362
*/

0 commit comments

Comments
 (0)