Created
April 30, 2022 16:30
-
-
Save jcuffe/a1d0e8fe70d15eb21501aa41b5ab3ef8 to your computer and use it in GitHub Desktop.
Invocation context example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useStore, component$ } from '@builder.io/qwik'; | |
import axios from 'axios'; | |
export const Main = component$(async () => { | |
const response = await axios.get('https://httpbin.org/') | |
const state = useStore({ name: 'World', status: response.status }); | |
return ( | |
<p>Status: {state.status}</p> | |
); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useStore, component$ } from '@builder.io/qwik'; | |
import axios from 'axios'; | |
export const Main = component$(async () => { | |
const state = useStore({ name: 'World', status: undefined }); | |
state.status = (await axios.get('https://httpbin.org/')).status; | |
return ( | |
<p>Status: {state.status}</p> | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment