【问题标题】:Fetching data using api with react typescript and spring boot使用带有 react typescript 和 spring boot 的 api 获取数据
【发布时间】:2020-07-17 04:33:56
【问题描述】:

我在下面有一个简单的 tsx 文件。
我已经设置了 springboot,并且能够通过 chrome 上的 localhost 访问数据。
我的问题是如何使用 API 连接到 Spring Boot 并访问这些数据?

function getdata(props) {
   return ( 
      <div>
        //data
     </div>
)
}

【问题讨论】:

    标签: reactjs typescript spring-boot


    【解决方案1】:

    我认为您可以通过使用简单的 ajax 调用来连接 api。 为此,如果您不使用 redux,则可以使用 axios。 如果您使用的是 redux,则可以使用任何中间件,例如 saga 或 epics。 我目前在我的项目中使用具有反应的史诗。如果你对 observables 有很好的理解,你可以使用史诗

    【讨论】:

      猜你喜欢
      • 2021-11-29
      • 1970-01-01
      • 2020-12-05
      • 2021-03-02
      • 2021-04-10
      • 2020-03-13
      • 1970-01-01
      • 1970-01-01
      • 2018-04-18
      相关资源
      最近更新 更多