I am giving remix a good first-time try and I think I love its approach to data handling. However, I am facing an issue with data returning "undefined" from the loader wrapper.
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 (
....
)
}
What am I really missing here? I'll appreciate a pointer here. It wouldn't be wise to use other react based approaches that isn't remix's