Answers for "flatlist like in reactjs"

-1

flatlist like in reactjs

There is no specific component like it is in react-native to do this kind of stuff, so I usually just use map() to achieve this kind of things.

But if it is reusable you can surely create a List component for yourself so that you don't write map() function each time for the same list.

Kind of like this:

function Item(props) {
   return <li>{props.value}</li>;
}

function MyList(items) {
   return (
    <ul>
      {items.map((item) => <Item key={item.key} value={item} />)}
    </ul>
  );
}
Posted by: Guest on November-16-2020

Code answers related to "flatlist like in reactjs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language