[英]ReactJS->How do i populate my state with the information from within a database?
So I have some JSON lists that look like this:所以我有一些看起来像这样的 JSON 列表:
const productsList=[
{
name: 'Product1',
image: productImage,
price: 36.96,
quantity: 1,
id: v4()
},
{
name: 'Product 2',
image: productImage,
price: 39.94,
quantity: 1,
id:v4()
},
]
That list is then shown on the page using the map function and it is also being stored in the state using mapStateToProps.然后使用 map function 在页面上显示该列表,并且它也使用 mapStateToProps 存储在 state 中。 My question is how can I fill the productsList with the data from within a sqlite database?
我的问题是如何用sqlite数据库中的数据填充 productsList?
Here are the things you need:以下是您需要的东西:
I can't write every line of the code that you need since it's a lot.我无法编写您需要的每一行代码,因为它很多。 Hopefully this gives you an idea.
希望这能给你一个想法。
The art of creating API is what backend developers do.创建 API 的艺术是后端开发人员所做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.