by James Priest
Log 1 | Log 2 | Log 3 | Log 4 | Log 5 |
---|---|---|---|---|
100 Days Round 1 | 100 Days Round 2 | 100 Days Round 3 | this log | 100 Days Round 5 |
This is part of Alexander Kallaway’s 100DaysOfCode challenge. More details about the challenge can be found here: 100daysofcode.com.
Commitment: I will code daily for the next 100 days.
Start Date | End Date |
---|---|
October 5, 2018 | February 24, 2019 |
Project: Udacity React Nanodegree Program
GitHub Repo: Redux Todos & Goals App
Progress: Continued Udacity Redux lesson for my React Nanodegree Program.
This lesson focused on connecting a UI to our store. It provided the following:
Here’s the subscribe code that loops through each store item and updates the DOM
store.subscribe(() => {
const { todos, goals } = store.getState();
document.getElementById('goals').innerHTML = '';
document.getElementById('todos').innerHTML = '';
todos.forEach(addTodoToDOM); // todos.forEach(todo => addTodoToDOM(todo));
goals.forEach(addGoalToDOM); // goals.forEach(goal => addGoalToDOM(goal));
});
You can read more in my notes: Udacity React & Redux - 2. UI + Redux
Links:
Project: Udacity React Nanodegree Program and Udacity Introduction to Python Programming
Progress: Continued Udacity Redux lesson for my React Nanodegree Program.
These lessons focused on dispatching actions on the the store. It also covered the following:
Here are a two reducers combined into a root reducer which is passed to the store.
const ADD_TODO = 'ADD_TODO';
const REMOVE_TODO = 'REMOVE_TODO';
const TOGGLE_TODO = 'TOGGLE_TODO';
const ADD_GOAL = 'ADD_GOAL';
const REMOVE_GOAL = 'REMOVE_GOAL';
function todos(state = [], action) {
switch (action.type) {
case ADD_TODO:
return state.concat([action.todo]);
case REMOVE_TODO:
return state.filter(todo => todo.id !== action.id);
case TOGGLE_TODO:
return state.map(todo =>
todo.id !== action.id
? todo
: Object.assign({}, todo, { complete: !todo.complete })
);
default:
return state;
}
}
function goals(state = [], action) {
switch (action.type) {
case ADD_GOAL:
return state.concat([action.goal]);
case REMOVE_GOAL:
return state.filter(goal => goal.id !== action.id);
default:
return state;
}
}
function app(state = {}, action) {
return {
todos: todos(state.todos, action),
goals: goals(state.goals, action)
};
}
// Create the store passing the root reducer.
const store = createStore(app);
You can read more in my notes: Udacity React & Redux - 1.5 Dispatching an Action
Links:
Project: Udacity React Nanodegree Program and Udacity Introduction to Python Programming
Progress: Continued Udacity Redux lesson for my React Nanodegree Program.
This was a long lesson that went into some depth. It covered key concepts related to Redux such as:
Here’s some sample code that takes state and an action. It decrements the count of ice cream flavor from state if the action is DELETE_FLAVOR and returns the new state.
function appReducer(state = [], action) {
if (action.type === 'DELETE_FLAVOR') {
return Object.assign(
[],
state,
state.map(iceCream => {
if (iceCream.flavor === action.flavor) {
return Object.assign({}, iceCream, {
count: iceCream.count - 1
});
}
return iceCream;
})
);
}
return state;
}
Here’s an image that illustrates this reduction process.
You can read more in my notes: Udacity React & Redux - 1.4 Updating State
Links:
Project: Udacity React Nanodegree Program and Udacity Introduction to Python Programming
Progress: Continued Udacity Redux lesson for my React Nanodegree Program.
Today’s lesson covered getting state from the store and subscribing to state change events.
This lesson also has us creating our own store from scratch in order to learn the concepts behind Redux. Here’s some of that code
function createStore() {
// The store should have four parts
// 1. The state
// 2. Get the state
// 3. Listen to changes on the state
// 4. Update the state
let state;
let listeners = [];
const getState = () => state;
const subscribe = listener => {
listeners.push(listener);
return () => {
listeners = listeners.filter(l => l !== listener);
};
};
return {
getState,
subscribe
};
}
You can read more in my notes: Udacity React & Redux - 1.3 Getting State & Listening for Changes
Links:
Project: Udacity React Nanodegree Program and Udacity Introduction to Python Programming
Progress: Continued Udacity Redux lesson for my React Nanodegree Program.
Learned some concepts behind what The Store is.
You can read more in my notes: Udacity React & Redux - 1.2 The Store
Links:
Project: Udacity React Nanodegree Program and Udacity Introduction to Python Programming
Progress: Started Udacity Redux lesson for my React Nanodegree Program.
Looks like this course is going to be split up into the following lessons:
You can read more in my notes: Udacity React & Redux - 1. Managing State Intro
I also started Intro to Python Programming and am learning the basics of the language such as:
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@10-code-review-enhancements on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
I got my project feedback and was given a handful of great suggestions in the code review. These include:
You can read more in my notes: ReactND Project 1 - My Reads: 9. Feedback & Response.
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@9-separate-components on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
The last step of this project was to separate each of the components into their own file. This allows for easy reuse and composition.
I submitted this project for review and now I wait to hear back.
You can read more in my notes: ReactND Project 1 - My Reads: 8. Prep for Submission.
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@8-sync-books-and-search on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today was about making sure any changes that happened on the search page was carried over to the main page.
I had to refactor a few things but was able to have changes reflected in both places.
Live Demo: reactnd-project-myreads@8-sync-books-and-search on CodeSandbox
You can read more in my notes: ReactND Project 1 - My Reads: 7. Sync Books & Search.
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@7-add-search-ajax on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today I focused building a dynamic search. As the user types the search page dynamically displays the results.
This involved:
You can read more in my notes: ReactND Project 1 - My Reads: 6.1 Build Search Input.
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@6-add-books-ajax on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today was about making Ajax call in the appropriate places and then processing those requests.
componentDidMount()
for fetch requestssetState()
to update app’s state componentDidMount = () => {
BooksAPI.getAll().then(books => {
this.setState({ books: books });
});
};
You can read more in my notes: ReactND Project 1 - My Reads: 5.2 Ajax to Get All Books.
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@5-add-books-state on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today I began adding interactivity to my React app. This started with introducing state to track my list of books. Here are some of the things added to the code
You can read more in my notes: ReactND Project 1 - My Reads: 5.1 Move Book to Shelf
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@4-add-props on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Now that the data is available inside the App, I started figuring out what to pass as props to each nested child component.
Here are a few steps I took.
You can read more in my notes: ReactND Project 1 - My Reads: 4.3 Introduce Props
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@4-add-props on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today I pulled down the data that my app will use so I could see how best to work with it. I used Postman for this.
I was then able to look at the structure and adapt the data to be passed as props to various child components.
You can read more in my notes: ReactND Project 1 - My Reads: 4.2 Create Static Data
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@3-split-components on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today I split up the code into components. This created a component hierarchy that I could then use on different pages of my app.
By the time I finished I had many more levels of nesting than I thought I would. But from what I read it’s best to have small components with minimal code for reusability rather than building large & overly complicated ones.
Here’s the hierarchy so far.
You can read more in my notes: ReactND Project 1 - My Reads: 4.1 Split UI Components
Links:
Project: Udacity React Nanodegree Program
// App.js
import React, { Component } from 'react';
import { Route, Link } from 'react-router-dom';
class BooksApp extends Component {
state = {};
render() {
return (
<div className="app">
<Route exact path="/" component={List} />
<Route path="/search" component={Search} />
</div>
)
}
}
Live Demo: reactnd-project-myreads@2-routing on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
Today I added React Router to the app and used that rather than relay on state to conditionally display UI.
This has the benefits of:
You can read more in my notes: ReactND Project 1 - My Reads: 3. Routing
Links:
Project: Udacity React Nanodegree Program
Live Demo: reactnd-project-myreads@1-starter-files on CodeSandbox
Progress: Continued my Udacity React Nanodegree Program.
This is the first of three projects that I have to complete successfully in order to receive my Nanodegree.
This project is book shelf app that tracks books
It should allow you to search for books, add books, and move them between shelves.
You can read more in my notes: ReactND Project 1 - My Reads: 2. Analysis
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
This lesson wrapped up the Create Contact input form and completed the operation by saving the record to the database.
This required the following to work properly.
form-serialize
pkg to so I could programmatically serialize the form fieldscreateContact
methodhistory.push
within Route component’s render prop.This last part “navigates” the app to our Contact List page.
You can read more in my notes: Udacity React Fundamentals - 5.6 Finish Contact Form
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
This lesson got me familiar with four key components of React Router. These are:
React Router is great in that it preserves & tracks nav history and allows you to use the browser’s back button. It also provides rendering based on the Route defined.
It basically provides navigation for React Single Page Applications.
You can read more in my notes: Udacity React Fundamentals - 5.3 The BrowserRouter Component
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
So today was spent Reading React Router docs and debugging something that was right in front of me the whole time.
I was using the setState
method rather than the state
property in my comparison. Unfortunately, the editor didn’t flag this as an error because it thought I was doing an assignment rather than an equality check.
You can read my notes: Udacity React Fundamentals - 5. React Router
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
This lesson introduced the concepts behind React Router and had us attempt to mimic this functionality through state.
Many things did not work including back button navigation, & proper state management.
React Router seems to solve for this by providing a framework to manage navigation of React Single Page Applications.
I also implemented a separate Create User page and added navigation buttons to the React Contacts App.
You can read more in my notes: Udacity React Fundamentals - 5. React Router
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
These last two days were spent diving deeper into the various stages that each lifecycle event occurs at.
Here’s a list of the most common events in the order in which they occur.
You can read more in my notes: Udacity React Fundamentals - 4.4 Lifecycle Event Stages
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Now I’ve moved onto Lifecycle Events. These are special methods that each component has which allows us to run custom behavior during certain times of the component’s lifecycle.
Some of the ones discussed were
You can read more in my notes: Udacity React Fundamentals - 4. Lifecycle Events
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
This is the last exercise in the State Management section of my React Fundamentals course.
It started with the basics of a chat application but it was non-functioning and all the code was static and placed in a single component.
I needed to split the app up into functional components and add code to make the app work. This was done through the use of props, state, & handler methods.
I broke the app down along the following lines.
You can read more in my notes: Udacity React Fundamentals - 3.17 Ex 2 - All Together
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Now I’m at the part of the course were we’re give a page of requirements and asked to build the app from scratch.
The first thing I did was draw out the UI elements. Then I drew squares around each separate functional area in order to create a component hierarchy.
Here’s what I used for the UI above.
This is what the final app looked like
You can read more in my notes: Udacity React Fundamentals - 3.16 Ex 1 - All Together
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
This exercise had us take a controlled component and split it up to be modularized from one large components to four separate ones.
This took me longer than I thought it would and was trickier than I realized because I had to map out how best to break up the components.
I followed the React docs recommendation of drawing boxes around each logical component
You can read more in my notes: Udacity React Fundamentals - 3.14 Ex 2 - Controlled Components
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
This exercise had us create a controlled component who’s value was updated by component state.
This is handled by the onChange attribute which is set to handleChange method.
class App extends Component {
state = {
value: ""
};
handleChange = e => {
const value = e.target.value;
this.setState({
value
});
};
render() {
return (
<div>
<input
type="text"
placeholder="Say Something"
value={this.state.value}
onChange={this.handleChange}
/>
{this.state.value === "" ? (
<p>This should mirror the text you typed into the input field.</p>
) : (
<p>{this.state.value}</p>
)}
</div>
)
}
}
You can read more in my notes: Udacity React Fundamentals - 3.13 Ex 1 - Controlled Components
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s lesson was all about Controlled Components which are form elements who’s state is managed by React state rather than the DOM.
I learned how to
You can read more in my notes: Udacity React Fundamentals - 3.12 Controlled Components
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s lesson introduced PropTypes. PropTypes allows you to define the datatype we expect to be passed to the component that PropTypes is defined for.
Here are some of the things you can define with PropTypes
Here’s a sample of what PropTypes defined for a ListContacts component might look like.
ListContacts.propTypes = {
contacts: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
handle: PropTypes.string.isRequired,
avatarURL: PropTypes.string.isRequired
})
),
onDeleteContact: PropTypes.func.isRequired
};
You can read more in my notes: Udacity React Fundamentals - 3.11 PropTypes
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s lesson took me 3 days to complete properly. It consisted of building out a simple Mental Math game with props and state.
I learned about the following
I read a couple great articles by Cory House on the subject.
⚠️ Avoid arrow functions & .bind() in render() ⚠️
We generally want to avoid declaring arrow functions or binding in render() for optimal performance.
You can set up this ESLint rule (jsx-no-bind) to help alert you to this issue.
See Cory House articles on Medium:
You can read more in my notes: Udacity React Fundamentals - 3.10 Managing State
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today I spent the day going through React’s Main Concepts documentation. This consists of 12 sections that build upon each other and that each detail a different fundamental aspect of the React ecosystem.
This was key to my digesting so many of React’s key concepts. It serves to fill in any blank spots and gives clear direction on things like:
I love how clear the examples are and that each one links to a CodePen that you can play with.
You can read more in the official React Docs
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s lesson consisted of updating component state.
State can be set with setState()
and can either be done by passing in a function.
// setState function
this.setState(prevState => ({ // <- implicit return of an object
count: prevState.count + 1
}))
or it can be done by passing in an object
// setState object
this.setState({
username: 'James'
})
Once state is updated React knows this and will call render() to re-render the component. This allows for fast, efficient updates to the app’s UI.
You can read more in my notes: Udacity React Fundamentals - 3.9 Updating State
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s lesson consisted of adding state to a component.
Here are some take-aways.
props
represent “read-only” immutable datastate
on the other hand represents mutable datastate
is tied to how the application looksTo add state to our components, all we need to do is add a state property to our class whose value is an object. This object represents the state of our component.
We can either add it as a class field,
class User extends React.Component {
state = {
username: 'Tyler'
}
}
or we can add it in the constructor
class User extends React.Component {
constructor(props) {
super(props);
this.state = {
username: 'Tyler'
};
}
}
You can read more in my notes: Udacity React Fundamentals - 3.8 Add Component State
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s exercises consisted of converting class components to stateless functional components.
Once again, this should be done if our component only has a render()
method.
Here’s the MovieCardList component.
const MovieCardsList = props => {
const { profiles, users, movies } = this.props;
const usersByMovie = {}; // create empty object
profiles.forEach(profile => {
const movieID = profile.favoriteMovieID; // get movieID as key
if (usersByMovie[movieID]) { // loop thru ea. profile item
usersByMovie[movieID].push(profile.userID); // push user onto array
} else { // else if movie key does not exit
usersByMovie[movieID] = [profile.userID]; // assign user array to key
}
});
const movieCards = Object.keys(movies).map(id => (
<MovieCard
key={id}
users={users}
usersWhoLikedMovie={usersByMovie[id]}
movieInfo={movies[id]}
/>
));
return <ul>{movieCards}</ul>;
}
Here’s the child MovieCard component.
const MovieCard = props => {
const { users, usersWhoLikedMovie, movieInfo } = props;
return (
<li key={movieInfo.id}>
<h2>{movieInfo.name}</h2>
<h3>Liked By:</h3>
{!usersWhoLikedMovie || usersWhoLikedMovie.length === 0 ? (
<p>None of the current users liked this movie.</p>
) : (
<ul>
{usersWhoLikedMovie &&
usersWhoLikedMovie.map(userId => {
return (
<li key={userId}>
<p>{users[userId].name}</p>
</li>
);
})}
</ul>
)}
</li>
);
}
You can read more in my notes: Udacity React Fundamentals - 3.6 Functional Components
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Today I learned about Stateless Functional Components
The lesson focused on refactoring the list portion of the UI shown above from a class component to a functional one.
Here are a few bullet points on using functions in place of classes for components.
render()
methodOne key take-away from the lesson was the statement.
“If you’re using React correctly, you’re going to notice you have a lot of components that simply take in some data via props and output some UI”
You can read more in my notes: React Fundamentals - 11.1 Stateless Fn Explained
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today I worked on more React props exercises. This one required the following:
Object.keys()
& Object.values()
Here’s some sample code.
class PopularMovies extends Component {
render() {
const { profiles, users, movies } = this.props;
const moviesArr = Object.values(movies);
return (
<div className="PopularMovies-container">
{moviesArr.map(movie => (
<div key={movie.id} className="PopularMovies-cell">
<h3>{movie.name}</h3>
<UserList movieID={movie.id} users={users} profiles={profiles} />
</div>
))}
</div>
);
}
}
You can read more in my notes: Udacity React Fundamentals - 3.5 Ex 2 - Passing Data
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today I worked on a props exercise. It required the following:
Here’s an example of the data used.
const profiles = [
{
id: 1,
userID: '1',
favoriteMovieID: '1',
},
// more records...
];
const users = {
1: {
id: 1,
name: 'Jane Cruz',
userName: 'coder',
},
// more records...
};
const movies = {
1: {
id: 1,
name: 'Planet Earth 1',
},
// more records...
};
You can read more in my notes: Udacity React Fundamentals - 3.4 Ex 1 - Passing Data
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today lesson covered the following
You can read more in my notes: Udacity React Fundamentals - 3.2 Passing Data with Props
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today lesson covered the following
You can read more in my notes: Udacity React Fundamentals - 2.3 Create React App
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today I used CodeSandbox to quickly spin up React dev environments for testing out various React concepts.
I LOVE this app. It is super easy to use. Includes ESLint, Prettier, great UI. Also has a beautiful editor with clean Color Themes and awesome monospace font (Dank Mono).
I used it to work on the following lesson exercises.
You can read more in my notes: Udacity React Fundamentals - 2.1 Rendering UI Intro
Links:
Project: Udacity React Nanodegree Program
Progress: Continued my Udacity React Nanodegree Program.
Today’s lesson discussed
Then the lesson started skirting the realm of Functional Programming with concepts of currying and functional composition
I was kind of blown away by the following code sample…
const shelf1 = [{name: 'book1', shelf: 'a'},{name: 'book2', shelf: 'a'}];
const shelf2 = [{name: 'book3', shelf: 'b'},{name: 'book4', shelf: 'b'}];
const allBooks = [...shelf1, ...shelf2];
const filter = books => shelf => books.filter(b => {
return b.shelf === shelf;
});
// currying.. produces array with 2 objects: book3 & book4
const shelf = filter(allBooks)('b'); // (2) [{...}, {...}]
console.log(shelf); // (2) [{...}, {...}]
Notice the use of double arrow functions in the filter
function expression we created.
const filterBy = filter(allBooks); // partial function
const booksOnShelf = filterBy('b');
console.log(booksOnShelf) // (2) [{...}, {...}]
Here we see the use of currying and partial functions. We also see the use of double arrow functions on the same line. The Blog Post Currying and ES6 Arrow Functions does a great job of explaining this sorcery.
You can read more in my notes: Udacity React Fundamentals - 1.5 React is Just javaScript
Links:
Project: Udacity React Nanodegree Program
Progress: I started my Udacity React Nanodegree Program today.
This first lesson covered to following.
You can read more in my notes: Udacity React Fundamentals - 1. Why React
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Today I documented everything that went into creating state for a component.
This includes:
.bind
to make sure this
is in the right contextYou can read more in my notes: React Fundamentals - 10. Component State
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Today I build my first component that used State.
The previous day was spent on JavaScript’s this
keyword along with .call()
, .apply()
and .bind()
function methods.
This was a necessary precursor to understanding how to manage state and set the context of the this
keyword.
The component I built was a simple clickable list that kept track of which item was clicked. This will be part of a larger UI that displays detail information based on the selected language.
You can read more here: React Fundamentals - 9. The ‘this’ keyword
Links:
Project: Tyler McGinnis React Fundamentals course
// Implicit Binding
// Left of the Dot at Call Time
var me = {
name: 'James',
age: 48,
sayName: function() {
console.log(this.name);
}
};
me.sayName(); // James
Progress: Today I reviewed the this
keyword in depth.
this
is one of the most misunderstood aspects of JavaScript because it’s context changes based on how the function or method containing this
is invoked.
I learned there are 4 types of binding for this
keyword.
The lesson goes into depth regarding what specifically is happening in each of the cases above and gives code examples.
You can read more here: React Fundamentals - 9. The ‘this’ keyword
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Today I learned about the following:
Here’s an example of components written as functions.
const ProfilePic = function(props) {
const { username } = props;
return <img src={`#${username}`} alt="" />;
};
const ProfileLink = function(props) {
const { username } = props;
return <a href={`https://www.fb.com/${username}`}>{username}</a>;
};
const Avatar = function(props) {
const { username } = props;
return (
<div>
<h3>Stateless Functional Components</h3>
<ProfilePic username={username} />
<ProfileLink username={username} />
</div>
);
};
<Avatar username="james-priest" />
Here’s an example of PropTypes being defined.
Users.propTypes = {
list: PropTypes.arrayOf(PropTypes.string).isRequired
};
ReactDOM.render(
<Users list={['Tyler', 'Mikenzi', 'Ryan', 'Michael', 23]} />,
document.getElementById('app')
);
You can read more here: React Fundamentals - 8.1 Functional Composition
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Today I worked with lists using .map
& .filter
.
Here’s a basic mapping example that uses a parent and child component.
class FriendsContainer extends React.Component {
render() {
const name = 'James Priest';
const friends = ['Evi', 'Joeylene', 'Brittany', 'Anusha', 'Divya'];
const containerStyle = {
border: '1px solid blue',
padding: '10px'
};
return (
<div style={containerStyle}>
<h3>Name : {name}</h3>
<ShowList names={friends} />
</div>
);
}
}
class ShowList extends React.Component {
render() {
const { names } = this.props;
const listStyle = {
border: '1px solid red',
padding: '10px'
};
return (
<div style={listStyle}>
<h3>Twitter Friends</h3>
<ul>
{names.map(friend => (
<li key={friend}>{friend}</li>
))}
</ul>
</div>
);
}
}
ReactDOM.render(<FriendsContainer />, document.getElementById('app'));
To see more advanced examples including the use of filter you can check my notes.
You can read more here: React Fundamentals - 7.3 Lists with map & filter
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Learned about props today.
Here are some specifics
Here’s a basic way of coding the component above.
const React = require('react');
const ReactDOM = require('react-dom');
class Badge extends React.Component {
render() {
return (
<div>
<h1>Badge 1</h1>
<img src={this.props.img} alt="" />
<h2>Name: {this.props.name}</h2>
<h3>Username: {this.props.username}</h3>
</div>
);
}
}
ReactDOM.render(
<Badge
name="James Priest"
username="james-priest"
img="https://avatars1.githubusercontent.com/u/27903822?s=460&v=4"
/>,
document.getElementById('app')
);
To see more advanced examples of props using ES6 destructuring see course notes.
You can read more here: React Fundamentals - 7. Dataflow with Props
Links:
Project: Udacity React Nanodegree
Progress: I signed up for Udacity’s React Nanodegree program today.
I had such a good experience with the Mobile Web Specialist Nanodegree program that I figured I’d use Udacity to get my React training as well.
This is a four months program that will cover the following:
We will also be required to build a separate project using each of the three technologies in order to receive our certification and complete the program.
Links:
Project: Configure linting & code formatting in VS Code for React development.
Progress: I spent the last 8 days experimenting with every kind of linting and code formatting configuration I could find for React development within VSCode.
I knew I wanted the following:
I found that in the following:
So far, so good. The real craziness started with trying to determine which packages, plugins, & configurations I should be using.
In all, I tried about 20 different package combinations before getting everything to work properly.
Here are a couple things I learned.
Prettier & ESLint explained
You can read more in my notes: React Fundamentals - 6. ESLint, Airbnb, & Prettier
Links:
Project: Tyler McGinnis React Fundamentals course
var React = require('react');
var ReactDOM = require('react-dom');
class HelloWorld extends React.Component {
render() {
return (
<div>Hello React!</div>
)
}
}
ReactDOM.render(<HelloWorld />, document.getElementById('app'));
Progress: This part of the course began deconstructing the aspects of a React component. It also contrasted that with a React element.
Learned about
You can read more in my notes: React Fundamentals - 5. First React Component
Links:
Project: Tyler McGinnis React Fundamentals course
// In webpack.config.js
module.exports = {
entry: './app/index.js',
module: {
rules: [
{ test: /\.(js)$/, use: 'babel-loader' },
{ test: /\.css$/, use: { 'style-loader', 'css-loader' }}
]
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
template: 'app/index.html'
})
],
mode: "development"
}
Progress: The next step in this course was learning how to configure Webpack.
Webpack, at its core, is a code bundler. It takes your code, transforms and bundles it, then returns a new version of your code.
I learned about
You can read more in my notes: React Fundamentals - 4. React Setup
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Learned something new about npm!
Previously, I was installing all my babel packages without using @babel
scope. This means my installs looked like this.
npm install --save-dev babel-core babel-preset-env babel-preset-react
It would then place these three related packages in the root of node_modules
directory.
Now I see I can install related packages to the same scoped directory provided the scoped packages exist.
The same install would look like this.
npm install --save-dev @babel/core @babel/preset-env @babel/preset-react
Here’s the directory structures
OLD DIRECTORY STRUCTURE NEW DIRECTORY STRUCTURE
/node_modules / node_modules
- babel-core - @babel
- babel-preset-env - core
- babel-preset-react - preset-env
- preset-react
This is a lot cleaner and allows me to keep related packages together.
Links:
Project: Tyler McGinnis React Fundamentals course
Progress: Just started Tyler’s React Fundamentals course.
I haven’t done any coding yet but I love that he takes the time to set the stage and give some necessary context to what React is all about.
He started by explaining some of the features of React.
He then breaks down the React ecosystem and explains the following:
Lastly, he covered additional examples of imperative vs declarative code and the benefits of declarative.
See my notes React Fundamentals 1. Why React to get a better sense of the material covered including:
Links:
Project: freeCodeCamp JavaScript Algorithms and Data Structures Certification
Progress: Redoing some JavaScript Algo’s
Now that I have my cert, I’m going back to see where I can refactor and update code. This was a Roman Numeral Converter that required some array manipulation.
I used .map
, .split
, .reverse
, & .join
. This one was fun bc it challenged without being too difficult.
Links:
Project: freeCodeCamp JavaScript Algorithms and Data Structures Certification
Progress: Last project completed!
This is the second freeCodeCamp certification that I had started in 2017 but had to put on hold because of my Udacity Nanodegree scholarship.
I finished the last of the final projects today!
This cert actually represents approximately 300 hours of coursework but I still have yet to complete the exercises for each of the sections.
Now that I have the cert, I’m going back to do each of the exercises before attempting the final projects once again. This will show me anything new I’ve learned and will give me a chance to refactor and tighten up my code.
Links:
Project: freeCodeCamp Responsive Web Design Certification
Progress: Last project completed!
This cert represents approximately 300 hours of coursework.
I actually had done most of it in 2017 but had to put it on hold due to my Udacity Nanodegree scholarship. I’ve now just gotten back around to finishing the final requirements & assignments.
Links:
Project: freeCodeCamp Responsive Web Design Certification
CodePen: Technical Documentation Page
Progress: Last project completed!
This is the fifth of five projects required for FCC’s Responsive Design Certification.
The Technical Documentation page has 13 content (HTML) & 3 layout (CSS) tests it must pass in order to be accepted. These include:
<header>
, <footer>
, <nav>
, <main>
, etc.)This documentation text was taken from the Vue.js website.
Links:
Project: freeCodeCamp Responsive Web Design Certification
CodePen: Product Landing Page
Progress: Another project completed!
This is the fourth project out of five required necessary for FCC’s Responsive Design Certification.
The Product Landing page has 13 content (HTML) & 3 layout (CSS) tests it must pass in order to be accepted. These include:
<header>
, <footer>
, <nav>
, <main>
, etc.)<form>
& <input>
elementsThe page is really nothing more than a skeleton framework for a product landing page. It’s still pretty rough and not fully flushed out but it serves to meet the baseline requirements.
Links:
Project: freeCodeCamp Responsive Web Design Certification
CodePen: Responsive Survey Form
Progress: Another project completed!
This is the third project I’ve completed out of five required projects necessary for FCC’s Responsive Design Certification.
So far I’ve done the following
The survey form uses the following HTML5 & CSS features.
Links:
Project: Host Restaurant Review app
Live Demo: Restaurant Review App
Progress: Restaurant Review PWA migration is complete!
This app was my capstone project for Udacity’s Mobile Web Dev Nanodegree.
The project required that we code against various HTML5 APIs with vanilla Javascript. We were not to use the assistance of any frameworks or external libraries except for a Promise library that wrapped the IndexedDB API.
Here’s a high level list of some of the functionality this app needed to produce.
Here’s a partial list of the APIs and technologies we needed use and demonstrate.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I learned how to build and deploy a website to Netlify using Continuous Deployment.
I had to do the following
.env
file for my API keysdotenv
npm packageprocess.env.<var>
syntaxYou can read more here: Restaurant Review App - Stage 4: Section 13. Deploy to Netlify.
Links:
Project: Update CV Resume
Progress: I added to my online resume and updated some portfolio apps.
Here’s what was done:
Items Remaining:
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I’m still wiring up my PWA app to work with a new database back end.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 12. UI/UX Updates.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I’m still wiring up my PWA app to work with a new database back end.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 11. Edit Review.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I’m still wiring up my PWA app to work with a new database back end.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 10. Delete Review.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I’m still wiring up my PWA app to work with a new database back end.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 9. POST Review.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I’m still wiring up my PWA app to work with a new database backend.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 8. Favorite Toggle.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 7. Streamlining Database.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
In order to host a copy of my version of the Mobile Web Restaurant Review app, I have to update the code to use a new series of REST endpoints.
These new endpoints are exposed by my hosted DB solution though restdb.io.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 6 Delete & Edit Buttons.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
In order to host a copy of my version of the Mobile Web Restaurant Review app, I have to update the code to use a new series of REST endpoints.
These new endpoints are exposed by my hosted DB solution though restdb.io.
Today’s work involved:
You can read more here: Restaurant Review App - Stage 4: Section 4 Get Restaurants.
Links:
Project: Google Udacity Coursework
Progress: Elective coursework - High Conversion Web Forms
This course teaches how to build html5 web forms that are lean, streamlined, and effective. This lesson dealt with touch events on web forms.
Lesson 4 included:
Read more: High Conversion Web Forms: Touch Support.
Links:
Project: Google Udacity Coursework
Progress: Elective coursework - High Conversion Web Forms
This course teaches how to build html5 web forms that are lean, streamlined, and effective. This lesson dealt with streamlining existing forms.
Lesson 3 reinforced the following principles.
Read more: High Conversion Web Forms: Fast Forms.
Links:
Project: Google Udacity Coursework
Progress: Elective coursework - High Conversion Web Forms
This course teaches how to build html5 web forms that are lean, streamlined, and effective. This lesson dealt with validation.
Lesson 2 started in with the following.
required
input fieldsmin
, max
, and step
attributessetCustomValidity()
method of the Constraint Validation APIRead more: High Conversion Web Forms: Validation.
Links:
Project: Google Udacity Coursework
Progress: Elective coursework - High Conversion Web Forms
This course teaches how to build html5 web forms that are lean, streamlined, and effective. This lesson is called Efficient Inputs.
Lesson 2 started in with the following.
label
label
elements based on orientationplaceholder
attribute on input
elementsdatetime-local
, date
, and time
Read more: High Conversion Web Forms: Efficient Inputs Part 2.
Links:
Project: Google Udacity Coursework
Progress: Elective coursework - High Conversion Web Forms
This course teaches how to build html5 web forms that are lean, streamlined, and effective.
Lesson 1 deals with
Read more: High Conversion Web Forms: Efficient Inputs Part 1.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finished MWS coursework - Completed Browser Rendering Optimization course
Today I finished the last lesson of this course. It dealt with avoiding the pitfalls of compositing and painting with regards browser rendering.
It dealt with:
Read more: Browser Rendering Optimization: Compositing & Painting.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued Browser Rendering Optimization course
Finished the fifth lesson on Optimization & Performance which dealt with Styles and Layout with regards to the render pipeline. It covered:
Read more: Browser Rendering Optimization: Styles and Layout.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued Browser Rendering Optimization course
Finished the last part of the fourth lesson which dealt with JS memory management. It covered:
requestAnimationFrame
instead of setTimeout
& setInterval
Read more: Browser Rendering Optimization: JavaScript Memory Management.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued Browser Rendering Optimization course
The fourth lesson dealt with the JavaScript Performance Debugging in Chrome’s Debugging tools. It covered:
requestAnimationFrame
Read more: Browser Rendering Optimization: JavaScript Debug.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued Browser Rendering Optimization course
The third Lesson dealt with the Performance panel in Chrome’s Debugging tools. It covered:
Read more: Browser Rendering Optimization: Debugging Tools.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued Browser Rendering Optimization course
The second Lesson was called App Lifecycle and it dealt with
Read more: Browser Rendering Optimization: App Lifecycle.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Started Browser Rendering Optimization course
The first Lesson is called The Critical Rendering Path and it covers the following
Read more: Browser Rendering Optimization: The Critical Rendering Path.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Finished HTTP & Web Servers course
This final section of this course covered a mix of subjects including the following.
Read more: HTTP & Web Servers: Real Work HTTP: Multi-threaded Model.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued HTTP & Web Servers course
This section dealt with deploying a simple web server built with Python to Heroku. Specifically the lesson covered
Read more: HTTP & Web Servers: Real Work HTTP: Deploy to Heroku.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Finishing MWS coursework - Continued HTTP & Web Servers course
This section dealt with creating HTTP Servers & Clients. It had us do the following:
http.server
to write our own http serversrequests
packageRead more: HTTP & Web Servers: The Web from Python.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Continuing MWS coursework - Started HTTP & Web Servers course
The first section of this course covered HTTP Requests & Responses. It had us do the following:
ncat
command line utilRead more: HTTP & Web Servers: Requests & Responses.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Continuing MWS coursework - Completed Client-Server Communications course
The last section of this course dealt with CORS and HTTP security.
Read more: Client-Server Communication: HTTP Security.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Continuing MWS coursework - Client-Server Communications
I’m continuing with my Nanodegree coursework in preparation for the Google MWS certification test.
This lesson dealt with HTTP2.
The lesson covered..
Read more: Client-Server Communication: HTTP/2.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Continuing MWS coursework - Client-Server Communications
I’m continuing with my Nanodegree coursework in preparation for the Google MWS certification test.
This lesson dealt with Secure HTTP or HTTPS.
The lesson covered..
Read more: Client-Server Communication: HTTPS.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
As part of the work required to host a copy of my version of the Udacity Mobile Web Nanodegree Restaurant app, I have to change all the Ajax requests to use my new hosted DB solution.
I chose a great hosted solution made available by restdb.io.
Their service allowed me to:
The next part involved constructing all the new requests and testing each of the new endpoints to ensure I was able to perform each operation as expected.
I first started by identifying each endpoint I’m currently using from my local DB. I then read RestDB’s excellent docs on how to build equivalent requests to access the same data.
I used Postman to track, build, & test each request.
You can read more here: Restaurant Review App - Stage 4: Section 3 Test REST API.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
I’ve settled on a great Database-as-a-Service (DBaaS) offering. They allow you to
This was perfect for replicating the local Node.js/Sails.js database that was provided us. And it relieves me from having to find a hosted Node.js solution.
Now I can change my Ajax calls to point to and use my new data source and be up and running.
See the code notes here: Restaurant Review App - Stage 4: Section 2 Build Database.
Links:
Project: Host Restaurant Review app
Progress: Restaurant Review PWA migration
The nanodegree only had three stages to complete in order to meet all requirements.
I’m adding a fourth stage which will include necessary changes to properly host this app as part of my online portfolio.
I started researching various Cloud services in order to find a solution to host the Restaurant app’s back end database and REST API.
In that effort I documented the following in my code notes
See the code notes here: Restaurant Review App - Stage 4: Section 1 NoSQL with RESTful API.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist) Coursework
Progress: Continuing MWS coursework - Client-Server Communications
So, now that I’ve successfully completed the Nanodegree requirements I’ve set my sights on taking the Google MWS certification test. In order to be best prepared, I’ll complete the remaining coursework first.
HTTP 1.1 deals with the following..
Read more: Client-Server Communication: HTTP/1.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist)
Progress: Completed the Restaurant Reviews App - Stage 3 project.
I submitted my project for review and got the results back. It passed with flying colors which made the extra weeks I put into it worth while.
One thing that threw me off though was the first line of the reviewer’s feedback, “where he said, “Great attempt”. Whad’ya mean “Great attempt?!?”.😂😂
It then went on to tell me that I had in fact completed the nanodegree! Whew!😅
See the code notes here: Restaurant Review App - Stage 3: Section 14 Stage 3 Review.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist)
Progress: Completed the Restaurant Reviews App - Stage 3 project.
This last part required me to tighten up the performance scores on this app.
I ran the tests from Chrome’s DevTools audits panel and did the following to bring the scores up
The new scores are enough to pass!
See the code notes here: Restaurant Review App - Stage 3: Section 13 Performance Tuning.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist)
Progress: Continued the Restaurant Reviews App - Stage 3 project.
I completed the last piece of functionality for this app which is the ability to mark a restaurant as a favorite while the app is offline.
I added the following:
See the code notes here: Restaurant Review App - Stage 3: Section 12 Offline Favorites.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist)
Progress: Continued the Restaurant Reviews App - Stage 3 project.
There were two places in my app where I was lazily reloading the page in order to redraw the data on the page.
This was clunky and didn’t make sense to do since I was using Ajax everywhere else to eliminate round-trips to the server.
See the code notes here: Restaurant Review App - Stage 3: Section 11 Kill Page Refresh.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist)
Progress: Continued the Restaurant Reviews App - Stage 3 project.
In this part of my project I finished the offline data processing queue. This is responsible for sending offline review data to the server once connectivity is re-established.
The code does the following:
See the code notes here: Restaurant Review App - Stage 3: Section 10 Post Offline Data.
Links:
Project: Google Udacity Nanodegree (Mobile Web Specialist)
Progress: Created a new GitHub repo for my Round 4 code log.
This now uses a dusky rose theme and has an updated nav which I’ve migrated over to my previous two logs.
I’m still finishing up my Udacity Mobile Web Specialist Nanodegree…
Hopefully will be done in another week…
Links: My GitHub repo https://github.com/james-priest/100-days-of-code-log-r4