How do I connect to sql database from react?

不羁岁月 提交于 2021-02-10 15:59:12

问题


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?


回答1:


You're going to have to build a server with API routes to query the data from your database.




回答2:


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



来源:https://stackoverflow.com/questions/42865650/how-do-i-connect-to-sql-database-from-react

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!