<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jim Nayzium</title>
    <description>The latest articles on Forem by Jim Nayzium (@jimnayzium).</description>
    <link>https://forem.com/jimnayzium</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1156567%2Fe105f006-8002-47a2-8fde-219c101fbbca.png</url>
      <title>Forem: Jim Nayzium</title>
      <link>https://forem.com/jimnayzium</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jimnayzium"/>
    <language>en</language>
    <item>
      <title>Why is setting a store value in load function bad?</title>
      <dc:creator>Jim Nayzium</dc:creator>
      <pubDate>Fri, 09 Aug 2024 13:47:52 +0000</pubDate>
      <link>https://forem.com/jimnayzium/why-is-setting-a-store-value-in-load-function-bad-44g7</link>
      <guid>https://forem.com/jimnayzium/why-is-setting-a-store-value-in-load-function-bad-44g7</guid>
      <description>&lt;p&gt;Per the sveltekit documentation and the tutorial, it says, "You may be tempted to do this," and then it shows an example of a store value being set inside a load function on your +page.js. It goes on to say that value will be available to all users, and that has confused me.&lt;/p&gt;

&lt;p&gt;My particular application needs are solved mosts conveniently by setting a store's value in the +layout.js file, and then dozens of small components reference that store's values instead of always having to  every time I use and re-use these components.&lt;/p&gt;

&lt;p&gt;I am just confused how setting the store value in the load function on the client side would impact all the users. It reads confusing.&lt;/p&gt;

&lt;p&gt;Can someone explain what they mean?&lt;br&gt;
Thanks.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>sveltekit</category>
    </item>
    <item>
      <title>Confused on +layout.js and +layout.svelte props passed in load() function...</title>
      <dc:creator>Jim Nayzium</dc:creator>
      <pubDate>Tue, 16 Jul 2024 16:11:29 +0000</pubDate>
      <link>https://forem.com/jimnayzium/confused-on-layoutjs-and-layoutsvelte-props-passed-in-load-function-dfj</link>
      <guid>https://forem.com/jimnayzium/confused-on-layoutjs-and-layoutsvelte-props-passed-in-load-function-dfj</guid>
      <description>&lt;p&gt;I have a load function in my root +layout.js file that is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export async function load() {&lt;br&gt;
// and all it returns is &lt;br&gt;
return {&lt;br&gt;
  prop1: true,&lt;br&gt;
  prop2: false,&lt;br&gt;
  prop3: "value 3"&lt;br&gt;
};&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
For the life of me, I cannot do anything in the +layout.svelte file to make these values show up. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;export let prop1;&lt;br&gt;
export let prop2;&lt;br&gt;
export let prop3;&lt;br&gt;
console.log("prop1 = " + prop1);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;gives me "prop1 undefined" in the console every time!&lt;br&gt;
I have tried deconstructing the export like&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let { prop1 } = data;&lt;br&gt;
// and&lt;br&gt;
let { prop1 } = props;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
and nothing works... no matter what I do!&lt;/p&gt;

&lt;p&gt;Is it because the load function is async? I need it to be async so I can fetch some external api's when it's done, but I was just testing the bare bones to try and understand how things worked.&lt;/p&gt;

&lt;p&gt;Any ideas on the load order of &lt;/p&gt;

&lt;p&gt;+page.js vs +layout.js&lt;br&gt;
+page.svelte vs +layout.svelte&lt;/p&gt;

&lt;p&gt;etc?&lt;/p&gt;

</description>
      <category>sveltekit</category>
    </item>
  </channel>
</rss>
