https://res.cloudinary.com/dvfhgkkpe/image/upload/v1582341710/react_node_workshop/image2.gif

Table of Contents

Now it's time to put together what we learned so far to build together a big project. We'll start with thinking about UI structure while being in the right React mindset

Component structure

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3c7983af-2e7e-4664-a25f-3aaebcc7c08f/Untitled.png

Thinking in React

Implementation Highlights

App.jsx

class App extends React.Component {
  constructor() {
    super();
    this.state = {
      username: "Lenny",
      list: data.music,
      formVisible: false
    };
  }
...
render() {
    return (
      <div>
        <Header />
        <div className="options">
          <button onClick={this.showForm}>NEW SONG</button>
        </div>
        <SongList
          name={`${this.state.username}'s list`}
          list={this.state.list}
        />
      </div>
    );
  }

This is similar to the Memes view we saw before. The only difference is that we're getting it from a JSON file instead of an API. The list is rendered to SongList which maps songs to Song components and displays it in a grid.

SongForm.jsx

state

class SongForm extends React.Component {
	constructor(props) {
	    super(props);
			this.state = {
	      id: "",
	      title: "",
	      artist: "",
	      album: ""
	    };
	  }
...

We have a state value for each of the form inputs