Posts

Showing posts with the label JavaScript

Starting my React Portfolio

      So I've mostly finished my portfolio in Blazor (there is a kink to work out with Auth0 and GitHub Pages, but it's mostly there!), and now I'm building a front-end in React. The more I've worked with React so far, the more I've liked it. Being able to isolate your code into components and see your work gradually appear without breaking the rest of your code is satisfying, and while JavaScript sometimes feels like someone spilled a programming language, it's actually very easy to code in. The most challenging aspect of code so far has been getting a list of objects from my API. I say challenging, but once I found the solution it was actually very very easy.     The API call is made easy with Axios, the heavy lifting in on line 7 and 8. We simply reach out to the endpoint and pull the data out of the response. Boom, list of projects. I found that the more complicated part of this came from when I needed to actually display those projects. The asynch...

React Class Components

Image
      To further practice React, I worked on a small, simple project from this PluralSight course by Samer Buna. I decided to throw that project into an actual React app, rather than using his great Playground tool. The project is just a simple form where a user can type in a GitHub username and it will be added to the list with their profile picture, name and company.     This simple project uses a few components, and it shows how to pass data down to child components, how to update data in a parent component from a child component. It also shows how to communicate with an API using Axios, a very common library for making HTTP requests to the browser. Class components reminded me a lot of Blazor components, we simply create a component which will have a render() call to display our HTML, and when we call that component we will pass data to it which will be available in our props object. See Below how the CardList component is called and given data: ...