You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import {Provider, connect} from 'react-redux'
import {createStore} from 'redux'
import {
BrowserRouter as Router,
Match,
Miss,
Link,
} from 'react-router'
// Not sure why this isn't working with destructuring
import MatchGroup from 'react-router/MatchGroup'
const store = createStore(function(state) {
return state
})
class App extends Component {
render() {
return (
<div>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/foo">Foo</Link></li>
<li><Link to="/Missed">Missed</Link></li>
</ul>
<MatchGroup>
<Match pattern="/" exactly render={() => <h1>Home</h1>}/>
<Match pattern="/foo" render={() => <h1>Foo</h1>}/>
<Match pattern="/bar" render={() => <h1>Bar</h1>}/>
<Miss render={({ location }) => (
<div>Nothing matched {location.pathname}</div>
)}/>
</MatchGroup>
</div>
)
}
}
function mapStateToProps(state) {
return Object.assign({}, state);
}
App = connect(mapStateToProps)(App);
ReactDOM.render(
<Provider store={store}>
<Router>
<App/>
</Router>
</Provider>, document.getElementById('root'))
Steps to reproduce
Load the app
Click the missed link
Expected Behavior
Component associated to Miss is rendered
Nothing matched /Missed
Actual Behavior
No component is rendered
More Info
If you click the link again then the component associated with Miss is rendered. This appears to be related to issue #4035. The issue occurs when App = connect(mapStateToProps)(App) is introduced. I'm not sure if this is an issue with redux doing something is shouldn't or the Miss implementation, but in anycase this is going to be an issue with applications that leverage Redux which is likely to be many.
The text was updated successfully, but these errors were encountered:
The Redux connect issue might be deeper than just the Miss case. Check out this pin which illustrates an issue even without the MatchGroup. If you comment out line 34 (the connect call) the links work as expected.
Any ideas on when alpha.6 might come out? I'm satisfied with moving forward with what I can, given the MatchGroup addition, but an npm build from a commitish "react-router:" https://github.com/ReactTraining/react-router.git#be62ac357e910e3c9f48dd66c14cb8cdf69891d1 fails.
lockbot
locked as resolved and limited conversation to collaborators
Jan 21, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
v4 master
be62ac3
Test Case
Steps to reproduce
Expected Behavior
Component associated to
Miss
is renderedActual Behavior
No component is rendered
More Info
If you click the link again then the component associated with
Miss
is rendered. This appears to be related to issue #4035. The issue occurs whenApp = connect(mapStateToProps)(App)
is introduced. I'm not sure if this is an issue withredux
doing something is shouldn't or theMiss
implementation, but in anycase this is going to be an issue with applications that leverage Redux which is likely to be many.The text was updated successfully, but these errors were encountered: