How can I access and display the error
property for a createResource
?
In this scenario, why is the error
initially set to undefined before it is thrown?
The logging shows that it first displays undefined
for the error before eventually getting to line error
.
import { render } from "solid-js/web";
import { For, createSignal, createResource, createEffect } from "solid-js";
const p_tau = async () => {
throw 'line error'
}
function Counter() {
let [s, setS] = createSignal()
let _r = createResource(s, _ => p_tau())
setInterval(() => {
setS(s() + 'h')
}, 1000)
createEffect(() => {
console.log(_r[0].error)
})
return (<>
</>)
}
render(() => <Counter />, document.getElementById("app"));