Skip to content

Instantly share code, notes, and snippets.

@yaralahruthik
Created December 7, 2021 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaralahruthik/388fa2d4d966a12dc515835ae47af143 to your computer and use it in GitHub Desktop.
Save yaralahruthik/388fa2d4d966a12dc515835ae47af143 to your computer and use it in GitHub Desktop.
import { useGetTodosQuery } from '../services/todo';
const ReduxWay = () => {
const { data, error, isLoading } = useGetTodosQuery();
return (
<div>
<h1>Redux Way</h1>
{error ? (
<>Oh no, there was an error</>
) : isLoading ? (
<>Loading...</>
) : data ? (
<>
<ul>
{data.map((item) => (
<li key={item.id}>{item.title}</li>
))}
</ul>
</>
) : null}
</div>
);
};
export default ReduxWay;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment