mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 23:57:49 +01:00
add key to selectors
This commit is contained in:
@@ -2,7 +2,11 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default function Selector(props) {
|
||||
const lists = props.lists.map(list => <option value={list.id}>{list.name}</option>);
|
||||
const lists = props.lists.map(list => (
|
||||
<option key={list.id} value={list.id}>
|
||||
{list.name}
|
||||
</option>
|
||||
));
|
||||
return (
|
||||
<div>
|
||||
<select defaultValue={props.list} onChange={e => props.onChange(e.target.value)}>
|
||||
@@ -14,7 +18,7 @@ export default function Selector(props) {
|
||||
|
||||
Selector.propTypes = {
|
||||
lists: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.number.isRequired,
|
||||
id: PropTypes.string.isRequired,
|
||||
slug: PropTypes.string.isRequired,
|
||||
})).isRequired,
|
||||
list: PropTypes.string.isRequired,
|
||||
|
||||
Reference in New Issue
Block a user