This is only my second question here, so sorry if it's in the wrong place or has the wrong tags or anything.
import React from 'react';
import { connect } from 'react-redux';
import { getUnits } from '../reducers/units';
import { Menu, Container, Grid, Header, Form } from 'semantic-ui-react';
class Units extends React.Component {
componentDidUpdate(prevProps) {
const { dispatch, course } = this.props
if (prevProps.course.id !== course.id)
dispatch(getUnits(course.id))
}
units = () => {
return this.props.units.map( unit =>
<ul>
<li key={unit.id}> {unit.name}</li>
<button>Edit Module Name</button>
<button>Delete Module</button>
</ul>
)
}
render() {
return (
<Container>
<Header as="h3" textAlign="center">Modules</Header>
{ this.units() }
</Container>
)
}
}
const mapStateToProps = (state) => {
return { units: state.units, course: state.course }
}
export default connect(mapStateToProps)(Units);
I'm getting the error in the title of this question even though I have keys in the li elements and they are unique. I can see that they're different in the redux dev tools state, but for some reason I still get that error. I have looked at other similar errors here on stackoverflow but none of those seemed to solve this specific problem.