I am wondering if anyone can show me how to connect my react app create with create-react-app to connect to a local mysql database. Is there any library out there that does this or do I have to start completely from scratch?
2 Answers
You're going to have to build a server with API routes to query the data from your database.
4 Comments
Zip
But create-react-app comes with a server. Do I need to create a separate server for this task?
Mike Hughes III
create-react-app comes with a webpack development server.
Zip
Yes. So I can just use that server?
Mike Hughes III
Nah I don't believe you can actually edit that server, you would have to build out your own with API routes.
You need some sort of backend server script build with language such as php or nodejs that will create api endpoints to be consumed by your react scripts
1 Comment
Zip
But create-react-app comes with a server. Do I need to create a separate server for this task?