Skip to content

Commit

Permalink
Update readme to point to new component docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdlehman committed Apr 6, 2015
1 parent 3bc4673 commit 742351e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
# Switcheroo

Switcheroo allows you to specify a React component that renders a specific component based on the URL. Looks at hash location by default (`location.hash`), but also supports [`pushState`](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history).
Switcheroo allows you to specify a React component that renders a specific component based on the URL. Looks at hash location by default (`window.location.hash`), but also supports [`pushState`](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history), which uses `window.location.pathname` for comparison.

The [`Switcher`](docs/components/Switcher.md) and [`Switch`](docs/components/Switch.md) components provided to you by switcheroo give you everything you need. Read the component docs for more information on configuring these components as well as the additional features/configuration hooks provided via optional props.

## Example

```js
import React, {Component} from 'react';
import {Switcher, Switch} from 'switcheroo';
import DefaultHeader from 'components/DefaultHeader';
import AccountHeader from 'components/DefaultHeader';
import StoreHeader from 'components/StoreHeader';
import Body from 'components/Body';
import Footer from 'components/Footer';
// more component imports ...

class MyComponent extends Component {
render() {
return (
<div>
<Switcher>
<Switch path="/" handler={DefaultHeader}/>
<Switch path="/login" handler={AccountHeader}/>
<Switch path="/store" handler={StoreHeader}/>
<Switch path="/" handler={DefaultHeader} />
<Switch path="/login" handler={AccountHeader} />
<Switch path="/store" handler={StoreHeader} />
</Switcher>
<Body />
<Footer />
Expand Down

0 comments on commit 742351e

Please sign in to comment.