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.

setValues and values

See original GitHub issue

If I have props.values as below

const {
 values,
 setValues
} = props

const {
 names
} = values

where names equals to the following object

{
  user1: 'jon',
  user2: 'darrell'
}

how do I use setValues to change names.user1 to ‘Louisa’ for example?

Do I have to pass the entire mutated values object into setValues? IE:

values.names.user1 = 'Louisa'
setValues(values)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
dorkbluecommented, Dec 6, 2017

Can I do this then? @6ewis @jaredpalmer

setFieldValue('names.user1', 'Louisa)

I eventually settled with the below initially.

values.names.user1 = 'Louisa'
setValues(values)
1reaction
doconixcommented, Jul 29, 2019

This thread is old, but if you’ve gotten here late, one solution is using the immer library:

form.setValues(
    produce(form.values, draft => {
        draft.foo = "bar"
    })
)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I use setValues to paste the data I got from getValues ...
Sets a rectangular grid of values (must match dimensions of this range). var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.
Read more >
How to Get and Set Values on Google Sheets using Apps Script
In this post, I demonstrate how to Get and Set Values using Google Apps Script on Google Sheets.
Read more >
Class Range | Apps Script - Google Developers
Method Return type Brief description activateAsCurrentCell() Range Sets the specified cell as the current cell . applyRowBanding() Banding Applies a default row banding theme to...
Read more >
setValues() - React Advanced Form - GitBook
Sets the values of the given fields. · This method is designed to update the fields values during the runtime without making the...
Read more >
setValues of Values, Methods Webix Docs - Documentation
Webix Documentation: Methods of Values. This page contains setValues documentation to help in learning the library.
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