The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Build a Github Repositories Component in React Native

Build a Github Repositories Component in React Native

5:52
We'll walk through building a Repositories component which receives an array of repositories on Github and loops over those creating a list of React Native View components.
Watch this lesson now
Avatar
egghead.io

We'll walk through building a Repositories component which receives an array of repositories on Github and loops over those creating a list of React Native View components.

Avatar
JP

Great tutorial so far and I know this is a nit picky thing but I think a more intuitive way of doing
repos.map((item, index) => {
// and then referencing repos[index] inside your map function...
});

would be to do this:
repos.map((repo, index) => {
// and then replace repos[index] with repo
// so repo.description, repo.name, repo.html_url etc...
});

Avatar
John Davison

I find myself bristling at the statement 'whenever you use map you have to specify the key' which is such a misdirecting statement. Map is just a method that does something, key's provide a critical way for React to keep track of what is and what should be rendered in the DOM. That distinction shouldn't be trivialized.

Avatar
Tyler

Hi John,

My teaching style for beginner focused lessons is to abstract many advanced topics. I agree with you that keys are very important in React, I disagree that a more in depth description was necessary for this video. I appreciate the feedback though and will try to make future videos less "hand wavy".

In reply to John Davison
Avatar
Bohdan Ganicky

I just wanted to say that it would be better to use some kind of proper id (e.g. the repository id) instead of map's index value (see https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318) during the list item rendering.

In reply to Tyler
Avatar

Since code are in es6, why not to use es6 "export default ClassName" instead of module.export=class?

Avatar
Raunaq Singh

Agree with you here completely.

In reply to Bohdan Ganicky
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?