<script>
import { searchState} from './sharedState.svelte.js'
function handleClick(){
// uses the automatically created setter
searchState.text = "bicycles";
}
import { treeState } from './sharedState.svelte.js';
function handleSecondClick(){
treeState.push('🌳');
}
</script>
<h2>Object</h2>
<button onclick={handleClick}>Search for bicycles</button>
<div class="debug">{JSON.stringify({searchState})}</div>
<h2>Array</h2>
<button onclick={handleSecondClick}>Add tree</button>
<div class="debug">{JSON.stringify({treeState})}</div>
<style>
.debug{
margin:10px 0px;
background-color: lightcyan;
padding: 10px;
border:1px solid #999;
}
</style>