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
SELECT * | |
FROM ( | |
SELECT IT.ID, | |
ROW_NUMBER() | |
OVER ( | |
PARTITION BY | |
IT.VendorId, | |
IT.ItemNumber, | |
I.StoreID | |
ORDER BY I.InvoiceDate DESC, IT.InvoiceID DESC |
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
// Browsers.tsx | |
export function Browsers() { | |
return <BrowsersList {...useBrowsers('https://google.com/myData.json')} /> | |
} | |
// useBrowsers.ts | |
export function useBrowsers(url: string): BrowsersListProps { | |
const {loading, data} = useFetch<FetchBrowsersResults>(url) |
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 {useState} from 'react' | |
import {Browser, BrowsersListProps} from '../components/BrowsersList' | |
import {useFetch} from '../../../hooks/useFetch' | |
export type FetchBrowsersResults = { | |
Browsers: Browser[] | |
} | |
export function useBrowsers(url: string): BrowsersListProps { | |
const {loading, data} = useFetch<FetchBrowsersResults>(url) |
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 {useEffect, useState} from 'react' | |
import {Alert} from 'react-native' | |
export type UseFetch<T> = { | |
loading: boolean | |
data?: T | |
} | |
export function useFetch<T>(url: string): UseFetch<T> { | |
const [loading, setLoading] = useState<boolean>(false) |
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 type FetchBrowsersResults = { | |
Browsers: Browser[] | |
} | |
export type UseFetch<T> = { | |
loading: boolean | |
// We use Generic. T - is a type argument that can be any type. | |
// We can useFetch() with any type | |
// ? means, that T can be undefined |
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 {useEffect, useState} from 'react' | |
import {Browser, BrowsersListProps} from '../components/BrowsersList' | |
export function useBrowsers(url: string): BrowsersListProps { | |
const [loading, setLoading] = useState(false) | |
const [browsers, setBrowsers] = useState<Browser[]>([]) | |
const [selectedBrowser, setSelectedBrowser] = useState<Browser | undefined>( | |
undefined, | |
) |
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 React from 'react' | |
import {StyleSheet, View} from 'react-native' | |
import AddModal from '../../../components/AddModal' | |
import BrowserItem from '../../../components/BrowserItem' | |
import {UIFriendlyList} from '../../../components/UIFriendlyList' | |
const styles = StyleSheet.create({ | |
container: { | |
justifyContent: 'center', | |
alignItems: 'center', |
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 React from 'react' | |
import {FlatList, FlatListProps, Text} from 'react-native' | |
import LoadingIndicator from './LoadingIndicator' | |
export type UIFriendlyListProps<T> = FlatListProps<T> & {loading?: boolean} | |
export function UIFriendlyList<T>(props: UIFriendlyListProps<T>) { | |
if (props.loading) { | |
return <LoadingIndicator /> | |
} |
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 UIFriendlyListProps<T> = FlatListProps<T> & {loading?: boolean} |
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 React from 'react' | |
import {FlatList, StyleSheet, View} from 'react-native' | |
import AddModal from '../../../components/AddModal' | |
import LoadingIndicator from '../../../components/LoadingIndicator' | |
import BrowserItem from '../../../components/BrowserItem' | |
const styles = StyleSheet.create({ | |
container: { | |
justifyContent: 'center', | |
alignItems: 'center', |