This file contains 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
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | |
icon: React.ReactNode | |
// ...other props | |
} | |
interface CustomDivProps extends React.HTMLAttributes<HTMLDivElement> { | |
content: string | |
// ...other props | |
} |
This file contains 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
const TIMEOUT = 3000 | |
Machine({ | |
id: 'fetchMachine', | |
initial: 'idle', | |
context: { | |
response: null, | |
error: null, | |
}, | |
states: { |
This file contains 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
const { cancel } = actions | |
function saveChanges() { | |
console.log('here') | |
} | |
const fetchMachine = Machine({ | |
id: 'selectionMachine', | |
type: 'parallel', | |
states: { |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) |
This file contains 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
// 1 | |
function fetchUsers() {} | |
const fetchMachine = Machine({ | |
id: 'multi-admin', | |
initial: 'fetch-users', | |
context: { | |
allUsers: [], | |
selected: [], |
This file contains 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
function fetchData() { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
reject(); | |
}, 1000); | |
}); | |
} | |
const goatMachine = Machine({ | |
initial: "idle", |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains 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
const priceCalculatorMachine = Machine({ | |
id: 'priceCalculatorMachine', | |
initial: 'active', | |
context: { | |
flag: false, | |
}, | |
states: { | |
active: { | |
on: { | |
TOGGLE: { |