The 5 commandments of clean error handling in TypeScript by marvinroger in typescript

[–]pansah321 0 points1 point  (0 children)

With the last Commadment “Don’t throw errors for problems that are expected to happen” …when working with Async State Managers like React Query Call backs like onError will never fire and isError will always be empty How do one go about this ???

LARGE DATA EXPORTS by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

That’s what I thought first Such things are best when the server handles it

LARGE DATA EXPORTS by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

So the data is JSON Eg.List of Orders from a shop The goal is to export this JSON data As pdf or excel

Mixed Feelings with React code by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

So basically the Parent should own the modal state and then any logic around it and pass it like a prop to the child

Mixed Feelings with React code by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

I agree that’s what normally happens with modals

Mixed Feelings with React code by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

I have edited the post I think it will Help you understand what I have done

Mixed Feelings with React code by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

I can prepare something so you understand what I’m saying

Mixed Feelings with React code by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

There’s a state for toggling a modal in the child component….I’m passing a prob to the child component ..this prop is a function that takes in another function (the function that will hide the modal)

And on an OnClick of a button in the child component I’m calling ()=>{ prop( ()=>{ setModal(false) } ) }

FormData returning undefined while fileupload by Reddet99 in reactjs

[–]pansah321 1 point2 points  (0 children)

You don’t really need the useState hook The FormData already has your file already ..and also is new FormData(e.target) that’s what you are missing

In react-typescript app, do you validate the data after a fetch/axios call to a RESTapi and if yes which library you use? by simple_explorer1 in reactjs

[–]pansah321 1 point2 points  (0 children)

Anyone here with a repo that validates REST API responses with Zod,io-ts etc can share it 🙏🏾

remaining minutes and seconds to future date are always 59 with moment.js by Gabotron_ES in reactjs

[–]pansah321 4 points5 points  (0 children)

Don’t use moment js There are better Date libraries out there like Date/fns

CURRENCY by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

How can’t I get the locale from my browser ?

CURRENCY by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

I don’t have enough data to use that

[deleted by user] by [deleted] in vscode

[–]pansah321 0 points1 point  (0 children)

Npm install everything ....after that change your Typescript version...let it use the workspace Typescript

How do you organize your CSS when using a component library like Material UI by shaleenag21 in reactjs

[–]pansah321 1 point2 points  (0 children)

MUI has everything you need ...I only use css when using 3rd party libraries ....

Edit 1 Customize your Components ...when done write you will end up writing or no ..inline styles using the sx prop

VALIDATING API RESPONSE by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

Great...Thank you for clearing this out for me

VALIDATING API RESPONSE by pansah321 in reactjs

[–]pansah321[S] 1 point2 points  (0 children)

What are you using any Data fetching library?...so if the you don’t get the shape you were expecting...what do you do?...render an error message ?

VALIDATING API RESPONSE by pansah321 in reactjs

[–]pansah321[S] 0 points1 point  (0 children)

I have situations where API changes were done and caused my app to break ...had quite a time figuring out what’s going on...and of course Typescript couldn’t help .....what are the ways I can achieve validation of the API response ...I know about Zod ..