react-router icon indicating copy to clipboard operation
react-router copied to clipboard

[Feature]: Add invariant if history is not passed to HistoryRouter

Open wojtekmaj opened this issue 3 years ago • 1 comments

What is the new or updated feature that you are suggesting?

Add invariant if history is not passed to HistoryRouter

Why should this feature be included?

Currently, using HistoryRouter without passing history prop ends with TypeError: cannot read property action of undefined, which isn't very helpful and looks like an error on RR's side, when in reality it's dev's fault.

wojtekmaj avatar Dec 22 '21 06:12 wojtekmaj

Have same problem!

acidcrash2005 avatar Apr 12 '22 10:04 acidcrash2005

I'm not sure we want to get into the business of adding an invariant to every required component prop - you can prevent these issues with Typescript if prop validation is important for your app.

brophdawg11 avatar Jan 09 '23 21:01 brophdawg11