DEV Community

Cover image for Reflecting on React
Julie Evans
Julie Evans

Posted on

Reflecting on React

During this past month or so I learned how to utilize React. Although I only learned the basics and can only make good use of two hooks, I can implement them in ways to make them work. I can also utilize JSX and React’s hooks to implement the same functionality as if I were using JavaScript. The primary different is the ease of use and the lack of complexity in the appearance. My favorite aspect of using JSX instead of simply using JavaScript, is that JSX looks similar to typical HTML and makes it easier to see what is going on in the code. Plus I can implement the JavaScript functionality directly into the same code I use for rendering. So for me it’s like looking at HTML that functions as JavaScript, which is both beautiful and easier to use, at least it is for me.

Other than how much better I like JSX in comparison to typical JavaScript, is the use of React, which is super great. I can use it to render the HTML by using JSX and use its hooks to store information and the like and minimize unnecessary extra loading or rendering. I really like using the useState hook, because it not only makes my life easier with it storing information, it is also really easy to use. I previously used simple variables in JavaScript to achieve the same functionality, but it was messy and complicated, and it just barely helped me to achieve the functionality I wanted. Looking back I probably overcomplicated my situation more than necessary, but regardless using useState is much kinder to me. Using the useState hook not only is simple to use, but is also not a strain to look at and can be used without much complexity.

In addition to the useState hook I learned to utilize the useEffect hook, which I primarily used in tandem with useState. This was to fetch data from an API or JSON file and store the data within a variable declared with useState and then be able to utilize that data with ease without extraneous fetch requests. The useEffect hook has other neat uses and side-effects that can be implemented here and there, but I found its use with fetch requests was very helpful and made things easier to look at and more organized for me to use. If you can find at least one use for it and be able to utilize it, then I think that is enough to get by.

I primarily used the useState and useEffect hooks, but I also learned about routing with “react-router-dom” and using its hooks. It’s extremely helpful and quicker using this routing, and the uses it has in addition to simple links make creating navigation bars and alternating page content super simple. In addition to React’s hooks and features that can be accessed and used by simply importing them, there are other features and the like that are just as easy to get a hold of and use. Rather than trying to learn how to accomplish something and straining to figure out the ins and out of a certain feature, you can simply import the feature itself. Working with features and components this way makes creating content and features so much simpler and quicker. Utilizing React and similar features is the coolest thing I have come across so far, and using it through JSX is a joy to look at and use. The combination of the two is a wonder to behold and an ease to use.

Top comments (0)