'How to fetch data from MySQL to React html table

Is there a way to get data from the MySQL database (this can be done whit the Node.js back-end), but I can not create a table from that data in React.js?

Is there a good option to do that?

(I'm creating an electron application whit react and I want to list all the users from the MySQL database) In PHP is like this https://www.w3schools.com/php/php_mysql_select.asp

var mysql = window.require('mysql');

function Test() {
    var connection = mysql.createConnection({
        host     : 'localhost',
        user     : 'root',
        password : 'root',
        port : 8889,
        database : 'loginsystem'
    });

    connection.connect();
    var sql = 'SELECT * FROM users';
    connection.query(sql, function (error, results, fields) {
        if(error){
          console.log(error);
        }
        if (!results.length){
          console.log("error_fetching_data_from_database --",results.length);
        }else{
            console.log(result)
        }
      });

    const listof = (
        //I want print out useres here like table from the database
    )

 return(listof)
}

export default Test;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source