Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions examples/master-detail/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ const Index = React.createClass({
})

const Contact = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
},

getStateFromStore(props) {
const { id } = props ? props.params : this.props.params
Expand Down Expand Up @@ -97,7 +100,7 @@ const Contact = React.createClass({
destroy() {
const { id } = this.props.params
ContactStore.removeContact(id)
this.props.router.push('/')
this.context.router.push('/')
},

render() {
Expand All @@ -116,6 +119,9 @@ const Contact = React.createClass({
})

const NewContact = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
},

createContact(event) {
event.preventDefault()
Expand All @@ -124,7 +130,7 @@ const NewContact = React.createClass({
first: findDOMNode(this.refs.first).value,
last: findDOMNode(this.refs.last).value
}, (contact) => {
this.props.router.push(`/contact/${contact.id}`)
this.context.router.push(`/contact/${contact.id}`)
})
},

Expand Down
5 changes: 4 additions & 1 deletion examples/passing-props-to-children/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { browserHistory, Router, Route, Link } from 'react-router'
import './app.css'

const App = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired
},

getInitialState() {
return {
Expand All @@ -30,7 +33,7 @@ const App = React.createClass({
})
})

this.props.router.push('/')
this.context.router.push('/')
},

render() {
Expand Down