I have build a Todo App with create-react-app. The store I\'m using is based on Local Storage(JS attribute of object window). Now I created a MySQL databases and want to con
You can't connect them directly.
JavaScript running in a web browser cannot speak the MySQL protocol (nor can it make raw network connections that would be needed to write an implementation in JS).
Instead, create a web service (in the programming language of your choice, which could be JavaScript running on Node.js (e.g. the code you have already + Express.js + some glue) and use Ajax to communicate with it.