Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add createMatchSelector function from connected-react-router #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nrjinua
Copy link

@nrjinua nrjinua commented Nov 24, 2021

for those who used createMatchSelector function from connected-react-router

@salvoravida
Copy link
Owner

Hi, thanks for this PR!

Some points I'd like to care about:

  1. state.router.location -> should use "selectRouterState" function as createReduxHistoryContext options.
  2. Why is in the react-router folder?

let lastMatch: match<{}> | null = null;
return (state: any) => {
const { pathname } = state.router.location ?? {};
if (pathname === lastPathname) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use selectRouterState

Copy link
Author

@nrjinua nrjinua Nov 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for response!
Usage of selectRouterState function - done
Separated folder - it's a specially react-router function that use "matchPath" from react-router

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it apply only to react router v5?

Copy link
Author

@nrjinua nrjinua Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrjinua nrjinua requested a review from salvoravida November 28, 2021 13:20
routerReducerKey?: string;
}

export const createMatchSelector = (path: string, options?: Options) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature should also allow an array of strings (as the connected-react-router signature does)

Suggested change
export const createMatchSelector = (path: string, options?: Options) => {
export const createMatchSelector = (path: string | string[], options?: Options) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants