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
import { useEffect, useRef } from 'react'; | |
export default function useOutsideClick(callback) { | |
const refElement = useRef(null); | |
useEffect(() => { | |
function handleClickOutside(event) { | |
if(refElement.current && !refElement.current.contains(event.target)) { | |
callback(); | |
} |
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
import { useEffect, useState } from 'react'; | |
export default function useFetch(apiUrl) { | |
const [data, setData] = useState(null); | |
const [loading, setLoading] = useState(true); | |
const [error, setError] = useState(null); | |
useEffect(() => { | |
const getData = async (url) => { | |
setLoading(true); |
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
import { useEffect, useState } from 'react'; | |
export default function useFetch(apiUrl) { | |
const [data, setData] = useState(null); | |
const [loading, setLoading] = useState(true); | |
const [error, setError] = useState(null); | |
useEffect(() => { | |
const getData = async (url) => { | |
setLoading(true); |
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
// Cyberpunk 2077 - plan aktualizacji, Źródło zdjęć: © CD Projekt Red | Jan Kowal // Pełny string, caption, source | author | |
// Cyberpunk 2077 - plan aktualizacji, Źródło zdjęć: © CD Projekt Red | |
// Źródło zdjęć: © CD Projekt Red | Jan Kowal | |
// Cyberpunk 2077 - plan aktualizacji | |
// source - 'Źródło zdjęć: © SOURCE' | |
// caption - Jeśli jest source to: 'CAPTION, ' | jeśli nie, to: 'CAPTION' | |
// author - Jeśli source to 'SOURCE | AUTHOR' | |
type imageDetailsType = { |
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 User { | |
name: string; | |
age: number; | |
occupation: string; | |
} | |
interface Admin { | |
name: string; | |
age: number; | |
role: string; |
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 User { | |
name: string; | |
age: number; | |
occupation: string; | |
} | |
interface Admin { | |
name: string; | |
age: number; | |
role: string; |
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
enum EmbedTypes { | |
CLIP = 'clip', | |
VIDEOS = 'videos', | |
} | |
const twitchRegex: RegExp = /[^/]*$/; | |
const twitchEmbedId = (url: string): string => { | |
const value = twitchRegex.exec(url); | |
return value ? value[0] : ''; | |
}; |
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
useEffect(() => { | |
const fetchData = async () => { | |
const result = await axios( | |
'someApi', | |
); | |
setData(result.data); | |
}; | |
fetchData(); |
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
type A = { | |
id: string; | |
message: string; | |
messageHeader: string; | |
type: string; | |
removeNotification: (id: string) => void; | |
}; | |
export type B = { | |
id: string; |
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
import { ContractorDto } from './contractor.dto'; | |
import { IncomeDto } from './income.dto'; | |
import { ExpensesDto } from './expenses.dto'; | |
import { | |
IdValidator, | |
PositionValidator, | |
DateOfEventValidator, | |
DescriptionValidator, | |
RegistryValidator, | |
ContractorValidator, |
OlderNewer