Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions content/guides/foundations/solid-primitives.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ function User({ id }) {
}
```

`createResource` returns some pretty cool stuff that you can use to display the state of the resource reactively, as you can see it has a `loading` property that is a boolean that is true when the resource is loading and false when it is not. It also has an `error` property that is an error object if there was an error while fetching the resource. `createResource` also has some options we can make use of to customize the behaviour here's a list of them and a short description on what they do.
`createResource` returns some pretty cool stuff that you can use to display the state of the resource reactively, as you can see it has a `loading` property that is a boolean that is true when the resource is loading and false when it is not. It also has an `error` property that is an error object if there was an error while fetching the resource. `createResource` also has some options we can make use of to customize the behaviour. Here's a list of them and a short description on what they do.

- `initialValue` : The initial value of the resource. This is useful if you want to display something while the resource is loading.
- `name` : The name of the resource. This is useful for debugging.
- `deferStream` : A boolean that determines whether you app should wait for the resource to finish before rendering to a stream. Note that this is only useful if you're making use of the `renderToStream` function.
- `deferStream` : A boolean that determines whether your app should wait for the resource to finish before rendering to a stream. Note that this is only useful if you're making use of the `renderToStream` function.
- `ssrLoadFrom` : This can be used to tell the resource if it should load it's initial data from the `initialValue` or from the server. This is useful if you have some server-side data that you would like to assign to this resource. This can be used by passing either `'initial'` or `'server'` to this option.
- `storage` : This option serves as an declarative way for you to store the resource's data. This is useful if you would like to store the data in a cache or something like that. This option takes a function that returns a tuple with two functions, an Accessor and a Setter of types any. Here's an example of how you can use this option.

Expand Down Expand Up @@ -252,4 +252,4 @@ This is just a simple way in which you can make use of more than one signal valu

<Aside>
To know more about Solid primitives you can check out the <a href="#">solid deep dive section</a>
</Aside>
</Aside>