reactReact

How to integrate it in React projects

First at all you need configure ShapeRQ for your project, you can do somthing like this:

loadConfig.ts
import { createConfig } from 'shape-rq'

export function createApi() {
     createConfig({
        APIs: {
            Cheese: {
                baseUrl: "https://cheese-api.onrender.com",
                auth: {
                    token: () => localStorage.getItem('cheesyToken'),
                    prefix: "Cheese"
                }
            }
        },
        debug: true,
        lang: 'en',
    })
}

and then

main.tsx
...
createApi()
...

The config is set once, on app start.

circle-exclamation

✅ What's next?

Let's get some cheese...


What if I need requests more then one API?

You can. Just do that:

And:

For fix it just add another token

❔How I can create new data?

Great queastion! The answer:

circle-info

More about requests there

Last updated