import { action, useAction } from "@solidjs/router";
const echo = action(async (message: string) => {
// Imagine this is a call to fetch
await new Promise((resolve, reject) => setTimeout(resolve, 1000));
console.log(message);
});
export default function MyComponent() {
const myEcho = useAction(echo);
myEcho("Hello from solid!");
}
import { action, useAction } from "@solidjs/router";
const echo = action(async (message: string) => {
// Imagine this is a call to fetch
await new Promise((resolve, reject) => setTimeout(resolve, 1000));
console.log(message);
});
export default function MyComponent() {
const myEcho = useAction(echo);
myEcho("Hello from solid!");
}