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 […]
Working with React Hooks is fun. In this code example, i’m basically going to show you how to create a form in functional components with useState. Also my form will include checkboxes. In handleChange function we are checking the type of input and if input is checkbox, we’re assigning event.target.checked to value variable instead of […]