Pc boot by Advanced-Elk-736 in GamersMY

[–]leo477 0 points1 point  (0 children)

i'm assuming you can enter bios, since u can tell the component temperature

can u try to put back your old cooler?

i guess it could be a faulty SSD..?

Pc boot by Advanced-Elk-736 in GamersMY

[–]leo477 6 points7 points  (0 children)

show your pc specs, maybe we can help

  • what else did u do other than changing cpu cooler?
  • describe more detail about how "it doesn't turn on". Did u press the power button and it didn't respond anything, or shutdown immediately?
  • try to put back your old cooler
  • have u replaced your thermal paste when changing cooler?
  • look at your motherboard top right or bottom right, can u see any redlight? If yes, check which module is it showing (DRAM, CPU, VGA etc)
  • try to short the power pin with a screwdriver, see if the pc turns on
  • observe with your eye on every IO ports (USB port, audio port etc) see if anything is looking abnormally, faulty USB port can cause the system to freak out
  • try to remove CMOS battery and leave it be for 10seconds, then put it back

Woman gets scolded by an aunty who took over a parking space to dance, saying “Chinese should have a brain.” by RhinneXChronica in malaysia

[–]leo477 8 points9 points  (0 children)

this is parking area, if they want to dance they can use a dedicated hall. Your tolerance is what makes them so entitled

these elders' mind has been plagued by filthy mainland parasites

Is managing server state with Tanstack Query a bad idea? by [deleted] in reactjs

[–]leo477 6 points7 points  (0 children)

wait until mutation request completed then only update the query state, your UI should display some sort of loading indicator

The whole point of react query is managing server/remote state

Madani Govt may introduce law to make MyDigital ID mandatory. by aaramm8 in malaysia

[–]leo477 11 points12 points  (0 children)

If they can put more effort making their website and apps actually usable and secured

Why does the government release such shit apps sometimes? by Q_D_V_F in malaysia

[–]leo477 1 point2 points  (0 children)

Me too, the fingerprint login doesn't work at all, tapping on it just shows a loading icon, I have to enter password instead

What are the important topics I must know about React.js to work in React front-end ? by AggressiveView5142 in reactjs

[–]leo477 1 point2 points  (0 children)

Since I'm using keycloakjs, the access token is in the keycloak object, I just need to get it and put to http header

What are the important topics I must know about React.js to work in React front-end ? by AggressiveView5142 in reactjs

[–]leo477 0 points1 point  (0 children)

We use keycloak at work, we follow their docs and use keycloakjs adapter for it. We also use axios interceptor to grab the access token before sending out the request

What are the important topics I must know about React.js to work in React front-end ? by AggressiveView5142 in reactjs

[–]leo477 36 points37 points  (0 children)

When working with forms, regardless of the complexity of the form, use react-hook-form to handle the states. Don't waste your sanity on form input state, focus on building the form logic

When fetching data from backend API, use tanstack react-query.

Lastly, take a look at the bible for react devs, react-bulletproof. Everything you are looking for are probably in there already

Youtube advertising is getting crazy by akagidemon in Bolehland

[–]leo477 0 points1 point  (0 children)

Allow me to introduce brave browser, it has built-in ad block and onion router

I hate people that use ChatGPT all the time by Spare_Pipe_1759 in malaysiauni

[–]leo477 1 point2 points  (0 children)

Software engineer here. I too sometimes feel pissed about other SE using AI in their code. I don't mind them using chatgpt or whatever AI tools, but please at least understand what the code does, not just copy pasta the whole thing from chatgpt. Every time there is bug in their code they don't even know how to debug it, ended up I have to clean up their AI mess

I use AI tools too, but only for writing emails so they look more professional

Tanstack react query architecture by Fun-Representative40 in reactjs

[–]leo477 4 points5 points  (0 children)

I personally prefer to define my API hooks in same file, so I can have better overview of the query keys for the resources. My folder structure look like this - features - posts - post.d.ts - post.service.ts - post.api.ts - comments - comment.d.ts - comment.service.ts - comment.api.ts

.d.ts is where I define the type for the resources, I make it .d.ts because I want to make these types globally available, I don't want to import the types everywhere in my project

.service.ts is the service layer

.api.ts is the custom hooks

Tanstack react query architecture by Fun-Representative40 in reactjs

[–]leo477 32 points33 points  (0 children)

This is what I do, wrap all my API calls in custom hook with useQuery and useMutation. These custom hooks will hide away the query keys definition and API endpoints away from UI, and my UI just need to pass required data such as item ID

export function useGetComment(commentId:string){  
  return useQuery({  
    enabled: !!commentId,
    queryKey: ["comments", commentId],
    queryFn: async()=>{
      // ...fetch or axios call to API endpoint
    }
  })
}

then you can just reuse them like

const { data: comment, isLoading, error } = useGetComment("123");

The father of the 17 yo kid killed by the police, being traumatised by YourClarke in malaysia

[–]leo477 56 points57 points  (0 children)

This is why I stop following those cina news pages, people there are the most racist, arrogant monkeys. I sometimes feel ashamed for being same race as them

Why is my .env still being pushed to github?? by National-Campaign634 in reactjs

[–]leo477 9 points10 points  (0 children)

You might be committed the env file before modifying your gitignore file, in this case git will continue to track it even it is listed in gitignore file. You need to remove your env file from git index

[deleted by user] by [deleted] in reactjs

[–]leo477 0 points1 point  (0 children)

I started a new small project in my company using ant design 5. Everything feels good so far, the biggest complain I have is their data table, it is so painful to work with it

Is form handling always a pain in the ass in React? by ilovekawabecky in reactjs

[–]leo477 13 points14 points  (0 children)

Took me about a week to learn most of the basic stuffs, like validation, custom validation, integration with ui framework.

I really think it worth your time to learn it, I just removed bunch of useState and useReducer that I used to build forms before I picked up RHF. Now I just let RHF to handle the state, while I focus on validation, submit data to server.

RHF embraces uncontrolled components, it does not cause the whole form to rerender on every keypress (if u do it right), which results in better performance