Skip to content

Commit

Permalink
🐛 Add correct keys
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlt committed Nov 20, 2023
1 parent 2e0915c commit 6d835d4
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions src/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ function Feed() {
.then(json => {
setUsers(json.results);
setLoadState(loadState - 1);
setIsRefreshing(false);
})
.catch(err => {
alert(err);
});
};
const handleLoadMore = () => {
Expand Down Expand Up @@ -104,24 +108,28 @@ function Feed() {
</View>
);
const renderItem = React.useCallback(
({ item, index }) =>
index > 0 ? (
<Post post={item} />
) : (
<React.Fragment key="userList">
{users.length > 0 && (
<UserList
userObjects={users}
style={{
marginLeft: -3,
marginBottom: 0,
marginTop: 0,
marginRight: -10,
}}
/>
)}
</React.Fragment>
),
({ item, index }) => {
if (index > 0) {
return <Post post={item} key={item._id} />;
} else {
return (
<React.Fragment key={index}>
{users.length > 0 && (
<UserList
userObjects={users}
style={{
marginLeft: -3,
marginBottom: 0,
marginTop: 0,
marginRight: -10,
}}
key={index}
/>
)}
</React.Fragment>
);
}
},
[users],
);
return (
Expand Down

0 comments on commit 6d835d4

Please sign in to comment.