反应+终极版用REST API? [英] React + Redux with a rest api?

查看:170
本文介绍了反应+终极版用REST API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的CRUD应用程序,我建设节点,完成创建防爆preSS的REST API。我现在希望增加前端功能,并希望使用反应+终极版作为一个学习的过程。然而,似乎所有的教程解决此直接访问使用终极版,而不是内部的API接口,数据

I have a simple CRUD app I am building in node, and have finished creating the rest API in Express. I am now looking to add front end functionality and wish to use react + redux as a learning exercise. It seems however all of the tutorials around this access the data directly using Redux, rather than interfacing with an internal API.

我的问题是,是正确的方式来建立与终极版一个SPA?我是IM pression这是最好的前端从后端分离出来,这样我可以,例如,建立一个iPhone应用程序,而不必重建后端之下。

My question is, is that the correct way to build a SPA with redux? I was under the impression it was best to separate the front end from the backend so that I could, for example, build an iPhone app and not have to rebuild the backend.

先谢谢了。

推荐答案

终极版本身无关,与API通信,它是客户端的状态管理库。您可以使用射击和处理请求的任何方法,最常见的是使用自定义API的连接中间件,返回功能,防火的要求,从动作的创造者和使用它们咚的中间件或使用替代方法,如 RX-桥梁或的传奇

Redux itself has nothing to do with API communication, it's the library for client-side state management. You can use whatever approach for firing and handling requests, most common are using custom api-connecting middleware, returning functions, which fire requests, from action-creators and using them with thunk-middleware or using alternative approaches like rx-bridges or sagas.

这篇关于反应+终极版用REST API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆