Skip to content

Instantly share code, notes, and snippets.

@kubilaykiymaci
Created November 28, 2018 14:12
Show Gist options
  • Save kubilaykiymaci/6f66baa43d9e2c4d7aaec9bc4a89c00a to your computer and use it in GitHub Desktop.
Save kubilaykiymaci/6f66baa43d9e2c4d7aaec9bc4a89c00a to your computer and use it in GitHub Desktop.
React Flow - PropsType
const GridType = {
article: "article",
text: "text",
test: "test"
}
type PropsType = {
name?: ?string, // ilk ? name prop'unun optional olduğunu
// ikinci ? ise name prop'unun string dışında null da olabileceğini gösterir
size?: Object | null, // bir diğer null olabilir gösterimi
onChange: () => void, // onChange bir fonksiyondur ve zorunlu alandır. Çünkü ? yok
currencyList?: Array<string>, // optional bir string array'i
grid: $Values<typeof GridType>, // oneOf kullanımı: grid prop'u GridType içerisindeki value'ları alabilir
...$Shape<any> // spread notasyonu (...props)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment