0

I have minimum date and maximum date control on more than one page on the yup side. My login service returns processDate: 12.26.2020 response and I want to pass the processDate parameter instead of using new Date() to all controls. How should I go? I am using context for state management.

friomorte
  • 17
  • 2
  • Create a wrapper date picker component, read the date returned by the server (either context/localstorage) and use the date picker component wherever you need in your app – Aamin Khan Dec 26 '20 at 11:20

1 Answers1

0

I think you need more code to get a more specific answer, there are a few patterns you could use:

  • Use getState/setState in parent instead of passing it down - best
  • Use a utility function in the components to convert the string, to prevent passing down Date()
  • Use something like Redex to manage state

Sounds like the issue is more prop passing than anything else?

Jon Jones
  • 1,014
  • 1
  • 9
  • 17