Grégoire Delattre 4b26080193
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Update redux state management
Use immer with native javascript objects instead of immutablejs.
2020-04-07 18:22:26 +02:00

28 lines
712 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import { useSelector } from "react-redux";
export const PolochonSelect = ({ value, changeValue }) => {
const publicPolochons = useSelector((state) => state.polochon.public);
return (
<select
className="form-control"
value={value}
onChange={(e) =>
changeValue(e.target.options[e.target.selectedIndex].value)
}
>
{publicPolochons.map((polochon) => (
<option value={polochon.id} key={polochon.id}>
{polochon.name} ({polochon.url})
</option>
))}
</select>
);
};
PolochonSelect.propTypes = {
value: PropTypes.string,
changeValue: PropTypes.func.isRequired,
};