Skip to content

Instantly share code, notes, and snippets.

@TianyuanC
Last active April 10, 2019 06:25
Show Gist options
  • Save TianyuanC/b5b1276d5c02d213159e2e18e5b15d46 to your computer and use it in GitHub Desktop.
Save TianyuanC/b5b1276d5c02d213159e2e18e5b15d46 to your computer and use it in GitHub Desktop.
Gift for Le Var
import React, { Component } from "react";
const users = {
1: {
id: 1,
name: "Jane Cruz",
userName: "coder"
},
2: {
id: 2,
name: "Matthew Johnson",
userName: "mpage"
},
3: {
id: 3,
name: "Autumn Green",
userName: "user123"
},
4: {
id: 4,
name: "John Doe",
userName: "user123"
},
5: {
id: 5,
name: "Lauren Carlson",
userName: "user123"
},
6: {
id: 6,
name: "Nicholas Lain",
userName: "user123"
}
};
const movies = {
1: {
id: 1,
name: "Planet Earth 1"
},
2: {
id: 2,
name: "Selma"
},
3: {
id: 3,
name: "Million Dollar Baby"
},
4: {
id: 4,
name: "Forrest Gump"
},
5: {
id: 5,
name: "Get Out"
}
};
export class Profile extends Component {
render() {
const theMovie = movies[this.props.profile.favoriteMovieID].name;
const theName = users[this.props.profile.userID].name;
return <p> {`${theName} likes ${theMovie}`} </p>;
}
}
import React from "react";
const users = {
1: {
id: 1,
name: "Jane Cruz",
userName: "coder"
},
2: {
id: 2,
name: "Matthew Johnson",
userName: "mpage"
},
3: {
id: 3,
name: "Autumn Green",
userName: "user123"
},
4: {
id: 4,
name: "John Doe",
userName: "user123"
},
5: {
id: 5,
name: "Lauren Carlson",
userName: "user123"
},
6: {
id: 6,
name: "Nicholas Lain",
userName: "user123"
}
};
const movies = {
1: {
id: 1,
name: "Planet Earth 1"
},
2: {
id: 2,
name: "Selma"
},
3: {
id: 3,
name: "Million Dollar Baby"
},
4: {
id: 4,
name: "Forrest Gump"
},
5: {
id: 5,
name: "Get Out"
}
};
export const Profile = function(props) {
const theMovie = movies[props.profile.favoriteMovieID].name;
const theName = users[props.profile.userID].name;
return <p> {`${theName} likes ${theMovie}`} </p>;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment