使用混音运行将数据发送到服务器
我正在使用混音运行将数据发送到服务器的问题 - 我不确定我完全了解使用方法数据的工作方式。我了解USELOADERDATA功能的工作方式,但是当您尝试将数据发送到服务器时,我会遇到错误。
我想做的是在单击按钮时将帖子请求发送到我的服务器 - 如果我尝试在Handleclick事件中调用Create Cart,则说CreateCart在似乎
const submit = useSubmit()
function action({ request }) {
is this where i do my POST api call?
}
async function handleClick(event) {
await createCart(id, amount)
}
找不到任何可以告诉您的文档 时,不是一个函数如何做?
I am having issues sending data to a server using remix run - I'm not sure I fully understand how useAction data works. I understand how the useLoaderData functions work but when you are trying to send data to a server I get errors.
What I want to do is send a post request to my server when I click a button - if I try and call create cart in the handleCLick event it says that createCart is not a function when it is
const submit = useSubmit()
function action({ request }) {
is this where i do my POST api call?
}
async function handleClick(event) {
await createCart(id, amount)
}
Cant seem to find any documentation which tells you how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过混音,操作总是在服务器上运行。这是当您发布路线时,混音将调用的方法。
With Remix, actions always run on the server. It is the method that Remix will call when you POST to a route.