diff --git a/src/data/question-groups/react/content/render-list.md b/src/data/question-groups/react/content/render-list.md new file mode 100644 index 000000000..f0241b6a9 --- /dev/null +++ b/src/data/question-groups/react/content/render-list.md @@ -0,0 +1,17 @@ +In React, you can render a list by using the JavaScript `map` function to iterate over an array of items and return a JSX element for each item. It's important to provide a unique `key` prop to each element in the list for React's diffing algorithm to function efficiently during re-renders. Here's a basic example: + +```javascript +const items = ['Apple', 'Banana', 'Cherry']; + +function FruitList() { + return ( +