Build a Github Repositories Component in React Native

Share this video with your friends

Send Tweet

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.

JP
JP
~ 10 years ago

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... });

John Davison
John Davison
~ 9 years ago

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.

Tyler McGinnis
Tyler McGinnis(instructor)
~ 9 years ago

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".

Bohdan Ganicky
Bohdan Ganicky
~ 9 years ago

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.

~ 8 years ago

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

Raunaq Sahni
Raunaq Sahni
~ 7 years ago

Agree with you here completely.