Sign in
Log inSign up
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?
Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct