Is there a way for React to take the back of an url user entered and pass it to a function? for example: www.site.com/foobar will pass the foobar to a function. Essencially what i'm trying to do is to run a check on foobar being in my database inside the checker function, if not there display 404 page not found.
const NotFound = () => (<h1>404.. This page is not found!</h1>)
class App extends Component {
checker : function(e){
if(foobar exists)
//load page with data
else
// {NotFound}
}
render() {
return (
<Router history={hashHistory}>
<Route path='/' component={LoginPage} />
<Route path='*' component={this.checker()} />
</Router>
)
}
}
foobaris an id?/something/:someIdand would handle/something/somereallylongtoken