Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistent data pattern across all the page components #37

Closed
aquibbaig opened this issue Nov 14, 2021 · 4 comments · Fixed by #42
Closed

consistent data pattern across all the page components #37

aquibbaig opened this issue Nov 14, 2021 · 4 comments · Fixed by #42
Labels
enhancement New feature or request

Comments

@aquibbaig
Copy link
Contributor

Based on our useFetch service, the data pattern needs to be consistent across all page components (this is definitely what we need for a more readable and efficient design), for example:

// top level
const {error, loading, data} = useFetch(url)

if (error) return <div className="errorStyles">{error.message}</div>

if (loading && !data) return <div className="loading"><Spinner /></div>

if (!data) return <div>No data for the request</div>

// finally, shows data if everything's alright
return <div>{data.data}</div>
@aquibbaig aquibbaig added the enhancement New feature or request label Nov 14, 2021
@akshatgarg12
Copy link
Contributor

Can i work on this issue?

@aquibbaig
Copy link
Contributor Author

@akshatgarg12 Sure, let me know if you need any help :)

Referencing a dependency in this comment #24

@akshatgarg12
Copy link
Contributor

@aquibbaig Shall i remove error as a prop from RouteList component, so that we can handle the error without passing it?

@aquibbaig
Copy link
Contributor Author

aquibbaig commented Dec 8, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants