In this article I will explain with an example, how to display Data from API using Fetch in ReactJS.
The JSON string returned from the API
The following JSON string is returned from the ASPSnippets Test API.
      "Name":"John Hammond",
      "Country":"United States"
      "Name":"Mudassar Khan",
      "Name":"Suzanne Mathews",
      "Name":"Robert Schidner",
Software Information
This article makes use of Visual Studio 2019, MVC 5 and .Net Framework 4.5.
Integrating ReactJS with ASP.Net MVC
For more information on integrating ReactJS with ASP.Net MVC, please refer my article ASP.Net MVC ReactJS Hello World Example.
The Controller consists of following Action method.
Action method for handling GET operation
Inside this Action method, simply the View is returned.
public class HomeController : Controller
    // GET: Home
    public ActionResult Index()
        return View();
ReactJS JSX file
Following ReactJS.jsx file consists of a CustomerTable class which extends ReactJS Component.
Inside the Construtor, the props variable is sent to the super class so that it can be used later in the render function.
Then an Array named customers is assigned to the state.
Event Handlers
This function is called when the React Component is loaded in the DOM.
Inside this function, a Cross Domain AJAX call is made to the external API using the Fetch API.
And inside the success event handler of the Fetch API, the received response is set in the customers Array of the state using the setState function.
Render function
The Render function returns an HTML Table with Header Row and dynamic rows generated using the customers array.
Inside the Render function, with the help of map function, the Table rows are dynamically generated using the customers Array.
Finally, the ReactDOM.render function, render’s the class in a HTML DIV with ID dvCustomersGrid.
class CustomerTable extends React.Component {
    constructor(props) {
        this.state = {
            customers: []
    componentDidMount() {
        .then(res => res.json())
            (customers) => {
                this.setState({ customers: customers });
            (error) => {
    render() {
        return (<table cellPadding="0" cellSpacing="0">
                { =>
    <CustomerTable />,
The View consists of an HTML DIV dvCustomersGrid inside which the generated HTML Table from the ReactJS will be displayed.
Then the following necessary JS files for ReactJS application are inherited.
1. fetch.min.js
2. react.development.js
3. react-dom.development.js
Finally, the ReactJS.jsx file is inherited.
    Layout = null;
<!DOCTYPE html>
    <meta name="viewport" content="width=device-width" />
    <hr />
    <div id="dvCustomersGrid"></div>
    <script type="text/javascript" src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src="@Url.Content("~/Scripts/ReactJS.jsx")"></script>
That’s it and the application is ready to run.
ReactJS: Display Data from API using Fetch