React Native + Worker + KV
# workers-help
h
Hello, I'm currently making a React Native app and I'm trying to get/send data to my KVs in cloudflare, however I'm not getting this to work. I'm new to cloudflare and workers in general, help would be appreciated. This is my fetch request currently, I don't know what to put in my worker to communicate with the KVs:
Copy code
ts
fetch('WORKER_URL', {method: 'GET'}).then((response) => response.json()).then((json) => {
    console.log(json);
  }).catch((error) => {
    console.error(error);
  });
My worker is currently just default with the Response Hello world due to not knowing what to do.
n
Hi! You have to first create a KV "namespace" in your dashboard, then you need to add it as a binding to your wrangler.toml file. https://developers.cloudflare.com/kv/learning/kv-bindings/#reference-kv-from-workers
Once you have it added as a binding, you will be able to referencing it from the
env
parameter from the
fetch
export. There's an example in the link above.
h
Do i need to create the wrangler.toml in my local project files or the quick edit thing in cloudflare of my worker?
I managed to receive data from a KV finally, forgot to add the KV namespace binding in the dashboard thing under Settings > Variables, Appreciate the help.