To create a function like this, which is 1. autoimported and 2. reactive without needing to add "$", wee can use the same method as we are doing with runQuery, where a vite script creates the import, moves the method call to a script tag and assignes the result to a variable, and finally replaces the original call with a suscription to that variable. After the transformation, it should look like this:
<script>
import { param } from '...';
const val = param('name');
</script>
<Input param='name' />
<Text.H1>
Hello, {$val}!
</Text.H1>
We need a
param
function to display parameters in views, like this:To create a function like this, which is 1. autoimported and 2. reactive without needing to add "$", wee can use the same method as we are doing with
runQuery
, where a vite script creates the import, moves the method call to ascript
tag and assignes the result to a variable, and finally replaces the original call with a suscription to that variable. After the transformation, it should look like this: