question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using useReducer for form data

See original GitHub issue

Have we discussed using useReducer instead of useState with an object for this? For this specific form it’s OK, but if we had more fields maybe useReducer hook would make it more readable, since we’re just implementing our own reducer later in the handleChange?

_Originally posted by @Zeko369 in https://github.com/freeCodeCamp/chapter/pull/140_

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
papigerscommented, Nov 10, 2019

Wouldn’t it better to just use Formik? No need to reinvent the wheel

0reactions
QuincyLarsoncommented, Nov 15, 2019

We had a vote during our Nov 15 conference call, and there was a consensus that we should try React-hook-form first and if we don’t like it, we can switch to Formik.

Read more comments on GitHub >

github_iconTop Results From Across the Web

useReducer Form Example - Medium
This is a quick and dirty example of how useReducer is a great way for controlling complex state through the example of form...
Read more >
Form Refactoring with useReducer React Hook (mini guide)
In this article, you are going to see a practical approach on how you can implement useReducer, and it also introduces the idea...
Read more >
Using useContext and useReducer to Manage a Form's State
So far, we have created the initial state, created the Reducer, and attached the event handler to our inputs. Now let's provide the...
Read more >
How to Build a Form in React with useReducer
First let's make a functional component in React to hold our form. import React, {useReducer} from "react"; const form = () => {...
Read more >
Reactjs form validation with useReducer hook
useReducer hook can be used to handle complex state management scenarios. Using regular state management becomes cumbersome when part of the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found