Skip to content

Instantly share code, notes, and snippets.

@oneybee
Created March 5, 2018 13:41
Show Gist options
  • Select an option

  • Save oneybee/b869a092ce1f2d22201d106601b6865c to your computer and use it in GitHub Desktop.

Select an option

Save oneybee/b869a092ce1f2d22201d106601b6865c to your computer and use it in GitHub Desktop.
reactapp/src/components/ExampleComponent.js
import React from 'react';
import Interactive from 'react-interactive';
import { Switch, Route, Link } from 'react-router-dom';
import ExampleTwoDeepComponent from './ExampleTwoDeepComponent';
import PageNotFound from './PageNotFound';
import s from '../styles/exampleComponent.style';
const ExamplePageText = () => (
<p style={s.p}>
여기는 Example Component 입니다. 자신이 원하는 글로 바꿔보세요.
</p>
);
export default function ExampleComponent() {
return (
<Switch>
<Route
exact path="/example/two-deep"
render={({ location }) => (
<div>
<ExamplePageText />
<ExampleTwoDeepComponent location={location} />
</div>
)}
/>
<Route
exact path="/example"
render={() => (
<div>
<ExamplePageText />
<div style={s.pageLinkContainer}>
<Interactive
as={Link}
{...s.link}
to="/example/two-deep?field1=foo&field2=bar#boom!"
>Example two deep with query and hash</Interactive>
</div>
</div>
)}
/>
<Route component={PageNotFound} />
</Switch>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment