Assume that we are getting a request in JSON format and we don’t want to hit the default error page of express.json() middleware. Instead we may want to send a specific JSON response back in case if JSON that we get is not valid. We can check the body of requests with the following middleware. […]
First example is from parent to child. Child to parent. More complex example.
Use async pipe or unsubscribe properly. For example if you ignite a http get request by visiting X component and then route to Y component without waiting your get request to complete, your get request in X component still runs. There are several ways to handle that issue. First one is, using async pipe. Async […]
In some cases, for example you may need to get userId from httpclient request then use that userId in another client request. Well, if you’re a beginner you will think about to handle it in subscribe in subscribe. Do not use subscribe in subscribe. Use mergeMap instead. Here is my model file including Todo and […]
We have two states. First one is user and second one is list. In first state we are holding our user_token, token_type and expiration values. Basically, we are running first useEffect when the page loads. It’s similar with ComponentDidMount(). We are being sure that user state is at is first state by checking with if […]