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.

[Feature] : Add a default value for data

See original GitHub issue

As initialValue only works for server-side rendering, it could be nice to have another prop (ex: defaultDataValue) so that we can controll the initial value of data.

This would improve developer experience with the lib.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ghengeveldcommented, Mar 11, 2020

That’s easily fixed:

const { data } = useAsync({ promiseFn });
const { todos = [], userPreferences = null } = data || {};
1reaction
SachinSharmaEcommented, Mar 19, 2020

Though i really like the solution of @ghengeveld still i kind of agree with OP on this. It would be beneficial to have defaultValue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Assign Default To Field (Data Management)—ArcGIS Pro
Creates a default value for a specified field. When a new row is added to the table or feature class, the specified field...
Read more >
Set default values for fields or controls - Microsoft Support
On the General tab, type a value in the Default Value property box. The value you that you can enter depends on the...
Read more >
Adding a field and setting default values yields no result
When using default values with new fields, the default value is only used with new features after the field has been created. In...
Read more >
MySQL 8.0 Reference Manual :: 11.6 Data Type Default Values
This means, for example, that you cannot set the default for a date column to be the value of a function such as...
Read more >
Specify default column values | BigQuery - Google Cloud
This page describes how to set a default value for a column in a BigQuery table. When you add a row to a...
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