11import { graphql } from 'gatsby' ;
22import PropTypes from 'prop-types' ;
33import React from 'react' ;
4- import { Grid } from 'react-bootstrap' ;
4+ import { Container } from 'react-bootstrap' ;
55import Layout from '../components/Layout' ;
66import Example from '../components/Example' ;
77
@@ -23,7 +23,7 @@ const propTypes = {
2323
2424const WithReactRouter = ( { data, location } ) => (
2525 < Layout data = { data } location = { location } >
26- < Grid >
26+ < Container >
2727 < h1 > Usage with React Router</ h1 >
2828 < p >
2929 People often want to animate route transitions, which can result in
@@ -38,14 +38,15 @@ const WithReactRouter = ({ data, location }) => (
3838 The main challenge is the < strong > exit</ strong > transition because React
3939 Router changes to a new route instantly, so we need to keep the old
4040 route around long enough to transition out of it. Fortunately,{ ' ' }
41- < code > Route</ code > 's < code > children</ code > prop also accepts a{ ' ' }
42- < em > function</ em > , which should not be confused with the{ ' ' }
43- < code > render</ code > prop! Unlike the < code > render</ code > prop,{ ' ' }
44- < code > children</ code > function runs whether the route is matched or not.
45- React Router passes the object containing a < code > match</ code > object,
46- which exists if the route matches, otherwise it's < code > null</ code > .
47- This enables us to manage the < code > in</ code > prop of{ ' ' }
48- < code > CSSTransition</ code > based on the presence of < code > match</ code > .
41+ < code > Route</ code >
42+ 's < code > children</ code > prop also accepts a < em > function</ em > , which
43+ should not be confused with the < code > render</ code > prop! Unlike the{ ' ' }
44+ < code > render</ code > prop, < code > children</ code > function runs whether
45+ the route is matched or not. React Router passes the object containing a{ ' ' }
46+ < code > match</ code > object, which exists if the route matches, otherwise
47+ it's < code > null</ code > . This enables us to manage the < code > in</ code > { ' ' }
48+ prop of < code > CSSTransition</ code > based on the presence of{ ' ' }
49+ < code > match</ code > .
4950 </ p >
5051 < p >
5152 Exit transitions will cause the content of routes to linger until they
@@ -63,7 +64,7 @@ const WithReactRouter = ({ data, location }) => (
6364 won't execute.
6465 </ p >
6566 </ blockquote >
66- </ Grid >
67+ </ Container >
6768 < Example
6869 codeSandbox = { {
6970 title : 'CSSTransition + React Router' ,
0 commit comments