My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
What is the best place to do user input validation in React/Redux?

What is the best place to do user input validation in React/Redux?

Marcus Pohorely's photo
Marcus Pohorely
·Apr 2, 2016

F.e: If have a form, with an input, on submit an action gets triggered which then post to an api. Now i have to validate if the user submitted something in the input field.

  • on Component Level: Seems wrong, because i can`t reuse the validation.
  • on Action Level: Seems like the best idea currently for me. F.e. return an generic Action Type like INPUT_ERROR with data and listen to this action in the reducer.
  • on Reducer Level: ?
  • Somewhere else?