Netlify does not recognize the URL params when using react-router-dom

I am creating a react app that uses react router. I am using the router to match the paths like :/bankName-:credit and it works fine in local development. The only require path for my application is :/bankName-:credit and every other path will hit 404.
But when I deploy this app to netlify then for default it goes to / and shows a custom 404. That’s all good. But now if I try to go to /hdfc-500 then it gives a netlify not found message that page not found.