React-router: v4 - computeMatch method question

Created on 9 Mar 2017  路  2Comments  路  Source: ReactTraining/react-router

Hi all,

A bit confused with idea of computeMatch method in Router.
On every history change this method is called but write same (but isExact property) data.

computeMatch(pathname) {
    return {
      path: '/',
      url: '/',
      params: {},
      isExact: pathname === '/'
    }
}

Whats the idea of using this? Should it write in store hash from current location?

All 2 comments

This is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux. Thanks!

Each location aware component may want to know what it's parent match is. We set a default match object in <Router> so that location aware components that are not rendered inside of a <Route> have default values to reference.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hgezim picture hgezim  路  3Comments

davetgreen picture davetgreen  路  3Comments

yormi picture yormi  路  3Comments

ackvf picture ackvf  路  3Comments

winkler1 picture winkler1  路  3Comments