I really need some help I am trying to figure out the issue for three days but no luck so if you can help I would really appreciated ....I am trying to build a simple app with react and json-server for back end the issue I am having the data has nested object so when even I fetch the data and try to modified it is throw error says the kay in nested obj undefined !! the question how to update the state has nested obj the is the user state const [getUser, setGetUser] = useState({ first_name: '', last_name: '', age: '', gender: '', address: { address1: '', address2: '', city: '', state: '', zip: '' }, order_total: { amount: 0 }, }); and this how onChnage fun works setGetUser({ ...getUser, [e.target.name]: e.target.value }) let see I want to update city in address obj how I can do that
how to update nested object using react and json-server
334 views Asked by Hayder Jebur At
1
There are 1 answers
Related Questions in REACTJS
- What is `_dereq_()` inside React?
- React TypeError: React.renderComponent is not a function
- React - saving a component in the ref callback
- React Rails component: manually triggering a re-render
- React, ES6 - getInitialState was defined on a plain JavaScript class
- How to get multiple selected options value in React JS?
- React.render replace container instead of inserting into
- reactjs datagrid use html
- props is not initialized in react component
- How to display xml data using Reactjs
Related Questions in JSON-SERVER
- Run two tasks/scripts that both "hog the terminal"
- Angular JS data response undefined
- How to host json-server in azure
- Type of “id” (number) in user.json is not supported. Use objects or arrays of objects error when using json-server, why?
- Error about CORS when anuglar accesses my-json-server on stackblitz
- How Do I Save A Mock API Call To 2 Places Using json-server?
- Expected Iterable, but did not find one for field \"Query.customers\
- React Admin - ReferenceInput with multiple fields output
- how to update nested object using react and json-server
- My JSON Server from Typicode updating database in ReactJS
Related Questions in NESTED-OBJECT
- Seeking advice how to process this nested JSON/Object
- updating a value of a nested object in nodejs
- ElasticSearch Filter by sum of nested documents
- Not null constraint failed in create method of nested serializer
- how to update nested object using react and json-server
- Rails form won't display value of new object attribute outside of select field
- JMeter PreProcessor - JSON EXtractor: Nested object
- How we can add and update both in nested array object in MongoDB C#
- Is there a way to set attribute to sub objects in a class?
- Getting hold of dynamically generated object with the help of selectors
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
When you write:
You are adding a new key value pair to the dictionary, not updating an existing one. If you want to update an existing key value pair, for example the city, you should try the following:
Eg: