> For the complete documentation index, see [llms.txt](https://uby-rn.gitbook.io/react-native/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://uby-rn.gitbook.io/react-native/ders-3.0/async-storage/kullanim.md).

# Kullanım

Orijinal dokümantasyon <https://react-native-async-storage.github.io/async-storage/docs/usage/>.

## Data yüklemek <a href="#storing-data" id="storing-data"></a>

Öncelikle telefonun hafızasına kaydetmek istediğimiz verileri belirleyip sonrasında `setItem()` fonksiyonunu kullanarak bir anahtar kelimeyi ve bir değeri parametre olarak ekleriz.

### Örnek Kullanım

#### import etmek

```jsx
import AsyncStorage from '@react-native-async-storage/async-storage';
```

#### Kullanmak

```jsx
const storeData = async (value) => {
  try {
    await AsyncStorage.setItem('my-key', value);
  } catch (e) {
    // hata kontrolü
  }
};
```

***

## Dataları Okumak

`getItem()`, verilen anahtar için veri bulunduğunda depolanan değere çözümlenen veya aksi durumda null değerini döndüren bir fonksiyondur.

### Örnek Kullanım

#### **String değeri okumak**

```jsx
const getData = async () => {
  try {
    const value = await AsyncStorage.getItem('my-key');
    if (value !== null) {
      // daha önceden depolanmış veri
    }
  } catch (e) {
    // değeri okumaya çalışırken hata olursa
  }
};
```

#### **Obje değeri okumak**

```jsx
const getData = async () => {
  try {
    const jsonValue = await AsyncStorage.getItem('my-key');
    return jsonValue != null ? JSON.parse(jsonValue) : null;
  } catch (e) {
    // değeri okumaya çalışırken hata olursa
  }
};
```
