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
type OriginalType = { | |
prop1: string; | |
prop2: number; | |
prop3: boolean; | |
}; | |
type ModifyProp<Type, Key extends keyof Type, Value> = Omit<Type, Key> & { | |
[K in Key]: Value; | |
}; |
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
/** | |
* First issue I see is the way how useEffect is defined | |
* The dependency list should not contain `setData`, but only `userId` | |
* | |
* The second issue is that there is no need to use `useEffect` | |
* in case the React component is using Suspense API | |
* So we can get rid of `useEffect` and `useState` as well. | |
* Instead we should call `fetchUserProfile` and pass the result to the child component. | |
* And also we can define `fallback` prop | |
* |
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
const fetchMachine = Machine({ | |
id: 'modalWindow', | |
initial: 'hidden', | |
context: { | |
submitDisabled: true, | |
closeDisabled: false, | |
}, | |
states: { | |
hidden: { |
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
export function mockFetchSuccess(data) { | |
return jest.fn().mockImplementation(() => | |
Promise.resolve({ | |
ok: true, | |
json: () => data, | |
}) | |
); | |
} | |
export function mockFetchFail(reason) { | |
return jest.fn().mockImplementation(() => Promise.reject(reason)); |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
const fetchMachine = Machine({ | |
id: 'investor', | |
initial: 'idle', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
idle: { | |
on: { |
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
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
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
@mixin ie11 { | |
/* stylelint-disable */ | |
_:-ms-input-placeholder, | |
/* stylelint-enable */ | |
:root & { | |
@content; | |
} | |
} | |
// Safari 10.1+ |
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
@mixin ie11 { | |
/* stylelint-disable */ | |
_:-ms-input-placeholder, | |
/* stylelint-enable */ | |
:root & { | |
@content; | |
} | |
} | |
// Safari 10.1+ |
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
.link { | |
height: 36px; | |
line-height: 36px; | |
display: inline-block; | |
/* position: relative is required for :after to work correctly */ | |
position: relative; | |
background-color: white; | |
color: black; | |
border: 1px solid gray; | |
} |
NewerOlder