2

I am learning react js with magento. I want to use magento rest api in my react js app how can i do that ?

1 Answer 1

2

In your React component call a fetch request like below:

import React from "react";

function App() {
 fetch("http://localhost/magento2/rest/V1/categories")
   .then((response) => response.json())
   .then((json) => console.log(json));

 return <div className="App">{}</div>;
}

export default App;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.