If I traditionally enqueue a script...
wp_enqueue_script('some-script', $dependencies_script_path, array( 'wp-i18n' ), false, $load_in_footer);
I can use wp_add_inline_script
to send info from wp_option
table to the front end javascript this way:
$beautiful_option = get_option('beautiful');
wp_add_inline_script('some-script', 'const BEAUTIFUL_OPTION=' .$beautiful_option, 'before');
And then, in the javascript file, I can, magically access the constant:
doMagicalThingsWith(BEAUTIFUL_OPTION);
How can I do this on the viewScript
of a block?