Fonksiyon İşlemleri

Değer Gönderilen ve Alınan Fonksiyon

import React from 'react';
import {Text} from 'react-native';

const getFullName = (
  firstName: string,
  secondName: string,
  thirdName: string,
) => {
  return firstName + ' ' + secondName + ' ' + thirdName;
};

const Cat = () => {
  return <Text>Hello, I am {getFullName('Rum', 'Tum', 'Tugger')}!</Text>;
};

export default Cat;

 

Fonksiyon Çağırma

import React from 'react';
import {Text, View} from 'react-native';

const Cat = () => {
  return (
    <View>
      <Text>I am also a cat!</Text>
    </View>
  );
};

const Cafe = () => {
  return (
    <View>
      <Text>Welcome!</Text>
      <Cat />
      <Cat />
      <Cat />
    </View>
  );
};

export default Cafe;

 

Örnek 3

import React from 'react';
import {Text, View} from 'react-native';

const KediFonksiyonu = GelenDegiskenler => {
  return (
    <View>
      <Text>Ben bir {GelenDegiskenler.KediAdi} kediyim! {GelenDegiskenler.Rengi} renkliyim</Text>
    </View>
  );
};

const Cafe = () => {
  return (
    <View>
      <Text>Welcome!</Text>
      <KediFonksiyonu KediAdi="Tekir" Rengi="Turuncu" />
      <KediFonksiyonu KediAdi="Pamuk" Rengi="Beyaz" />
      <KediFonksiyonu KediAdi="Minik" Rengi="Siyah"/>
    </View>
  );
};

export default Cafe;

Sonuç

Fonksiyon İşlemleri

 

import React from 'react';
import {Text, View, Image} from 'react-native';

const KediGoster = (GelenDegerler) => {
  return (
    <View style={{alignItems: 'center'}}>
      <Image
        source={{
          uri: GelenDegerler.ResimYol,
        }}
        style={{
          width: 100,
          height: 100,
          borderWidth:10
        }}
      />
      <Text>{GelenDegerler.KediAdi}</Text>
    </View>
  );
};

const Yaz =() =>{
  return (
    <View>
      <KediGoster ResimYol="https://www.everclean.com.tr/wp-content/uploads/sites/11/2019/02/Brown-cat.jpg" KediAdi="Tekir" />
      <KediGoster ResimYol="https://ideacdn.net/shop/bm/44/myassets/blogs/kediszroulari.png?revision=1666793247" KediAdi="Pamuk"  />
      <KediGoster ResimYol="https://www.everclean.com.tr/wp-content/uploads/sites/11/2019/02/Brown-cat.jpg"  KediAdi="Karabaş"  />
      </View>
  );
};

export default Yaz;

   

Fonksiyon İşlemleri

Yorumunuzu Ekleyin

Yükleniyor...