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

alexyaseen picture alexyaseen  路  3Comments

ryansobol picture ryansobol  路  3Comments

misterwilliam picture misterwilliam  路  3Comments

wzup picture wzup  路  3Comments

sarbbottam picture sarbbottam  路  3Comments