Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Add default / initial value to useSynced

Topic Labels: Custom Extensions
339 0
cancel
Showing results for 
Search instead for 
Did you mean: 

Similar to useState intial state.

Otherwise, there will always be boilerplate code of if value is null then value is initial value:

let [value, setValue, canSetValue] = useSynced('myGlobalConfigKey');
if (value == null) {
  value = 'initialValue';
}

Cheers,
Ronen Babayoff
Superblocks.at

0 Replies 0