小编Bad*_*men的帖子

混音加载器返回“未定义”

我第一次尝试 remix,我想我喜欢它的数据处理方法。但是,我面临数据从加载器包装器返回“未定义”的问题。

import { LoaderFunction } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import axios from 'axios';
const url = 'https://jsonplaceholder.typicode.com/users'

export async function Members(){
const {data} = await axios.get(url);
 return data
} //I am sure it returns the expected data when I call on this function.

export const loader: LoaderFunction = async () => {
const response = await Members()
 return response
};

export const Architects = () => {
  const members = useLoaderData()
  console.log(members)

  return (
    .... …
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks remix.run

10
推荐指数
1
解决办法
4131
查看次数

标签 统计

react-hooks ×1

reactjs ×1

remix.run ×1