With react, and a reusable, or reactive component..... is there a default Axios layout? That you just add the desired code you want? Or is it suppose to be different?
I have a snippet for a component, useComponent type of setup, but.... is a basic template ideal? Or should it be different?
Top comments (3)
I'm not sure if I got your question right. Axios is an http client, which represents the business logic of sending requests to - and receiving responses from your backend. You might add it as part of a component. I don't think it makes sense to use it as such standalone.
Perhaps you're striding to create an axios instance, which you can then require as a mixin for one or more components. Or add it directly to it as a method.
I mean that as in to use it, like a JS file of Info.js and SetInfo.js
Then try the following, given you have axios installed
Then, in the component in which you'd like to use the instance:
I've only tried this in Vue and Vanilla, in React it cannot be too different though :)