{"id":403251,"date":"2024-06-29T17:01:00","date_gmt":"2024-06-29T17:01:00","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=403251"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T17:01:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=403251","title":{"rendered":"<span>\u0422\u0430\u0431\u043b\u0438\u0446\u044b \u0432 react<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435: \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u043e\u0444\u043e\u0440\u043c\u0438\u043c?<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>npx create-react-app<\/code><\/p>\n<p>\u0412 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 app.js \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u0440\u0430\u0431\u043b\u0435\u0439 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0438\u0445 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 redux (\u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0443\u0434\u0430):<\/p>\n<pre><code class=\"javascript\">\/\/ app.jsx  const App = () => {   const dispatch = useDispatch();    useEffect(() => {     const getNews = async () => {       const {data} = await axios({         method: `get`,         url: `http:\/\/swapi.dev\/api\/vehicles`       })        dispatch(setStarships(data.results))     }     getNews();   }, [])    return (     &lt;div className=\"App\">       &lt;Table \/>     &lt;\/div>   ); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<pre><code class=\"javascript\">\/\/ table.jsx  const Table = () => {   const starships = useSelector(({ starships }) => starships.starships);    return (     starships       ? &lt;div className=\"table\">         &lt;TableHeader \/>         {starships.map((starship, idx) => &lt;TableRow key={idx} starship={starship} \/>)}       &lt;\/div>       : &lt;div>loading...&lt;\/div>   ) };<\/code><\/pre>\n<p>\u0421\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<pre><code class=\"javascript\">\/\/ table-row.jsx  const TableRow = ({starship}) => {   const {     cargo_capacity,     cost_in_credits,     max_atmosphering_speed,     name   } = starship     return (     &lt;div className=\"table__row\">       &lt;TableCell item={cargo_capacity} \/>       &lt;TableCell item={cost_in_credits} \/>       &lt;TableCell item={max_atmosphering_speed} \/>       &lt;TableCell item={name} \/>     &lt;\/div>   ) };<\/code><\/pre>\n<p>\u042f\u0447\u0435\u0439\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ item }) => {   const [state, setState] = useState(item);    return (     &lt;div className=\"table__cell\">       &lt;input         value={state}         onChange={({ target }) => setState(target.value)}         type=\"text\" \/>     &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u0442\u0435\u0439\u0442\u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430, \u044f\u0447\u0435\u0439\u043a\u0430 \u043c\u044b \u043a\u043b\u0430\u0434\u0451\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u043e\u043f\u0441\u043e\u0432 \u0432 \u0441\u0442\u0435\u0439\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0433\u043e. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044f\u0447\u0435\u0439\u043a\u0435, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438. (\u0414\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 flash updates, \u044f \u0443\u0431\u0440\u0430\u043b <code>outline<\/code> \u0443 <code>input<\/code> \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <code>:focus<\/code>, \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0430\u043a!)<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53f\/2c7\/2b9\/53f2c72b99c6d167f286b0769c84ee06.gif\" width=\"800\" height=\"345\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53f\/2c7\/2b9\/53f2c72b99c6d167f286b0769c84ee06.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0412\u044b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b! <\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/1\/commits\/7ba67a08a91570202fdd9df6d6fe8d075b3c8b04\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<h2>\u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u0439\u0442\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044f\u0447\u0435\u0435\u043a \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e? \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a\u0430\u043a \u0432 google sheets \u0438 \u0447\u0442\u043e\u0431\u044b \u0435\u0449\u0451 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e? \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/mobius1.github.io\/Selectable\/index.html\" rel=\"noopener noreferrer nofollow\">https:\/\/mobius1.github.io\/Selectable\/index.html<\/a><\/p>\n<p><code>npm i selectable.js<\/code><\/p>\n<p>\u0412 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 Table \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 selectable<\/p>\n<pre><code class=\"javascript\">\/\/ table.jsx  const Table = ({ starships }) => {    const escKeyDownHandler = useCallback((evt) => {     if (evt.key === `Escape` || evt.key === `Esc`) {       evt.preventDefault();       window.select.clear();     }   }, [])  useEffect(() => {      window.select = new Selectable({       appendTo: `.table`,       autoRefresh: false,       lasso: {         border: '1px solid blue',         backgroundColor: 'rgba(52, 152, 219, 0.1)',       },        ignore: [         `input`       ],     })    }, []);    useEffect(() => {     document.addEventListener(`keydown`, (evt) => escKeyDownHandler(evt));     return document.removeEventListener(`keydown`, escKeyDownHandler);   }, [escKeyDownHandler]);      return (   ...       ) };<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 ignore <code>input<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0444\u043e\u043a\u0443\u0441\u0435 \u0432 \u043d\u0451\u043c, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e. \u0422\u0430\u043a\u0436\u0435 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430 <code>esc<\/code> \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043d\u0430 \u044d\u0442\u0443 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/494\/b63\/358\/494b6335818be0993590efb8af857c83.gif\" width=\"600\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/494\/b63\/358\/494b6335818be0993590efb8af857c83.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0435\u0447\u0430\u0442\u0430\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445. \u041d\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c? \u0412 React \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u0439\u0442\u0430 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u044c \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u043f\u0434\u0435\u0439\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 redux, \u0447\u0442\u043e \u043c\u044b \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0435\u0440\u0432\u044b\u0439. \u0421\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043f\u0440\u043e\u043f\u0441\u043e\u0432 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 TableCell<\/p>\n<p>\u0411\u044b\u043b\u043e:<\/p>\n<pre><code class=\"javascript\">&lt;TableCell item={cargo_capacity} \/><\/code><\/pre>\n<p>\u0421\u0442\u0430\u043b\u043e:<\/p>\n<pre><code class=\"javascript\">&lt;TableCell url={url} item={{cargo_capacity}} \/><\/code><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0438\u043c\u044f \u044f\u0447\u0435\u0439\u043a\u0438 \u0438 url \u043a\u0430\u043a \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0442\u0440\u043e\u0447\u043a\u0438<\/p>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 TableCell:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ item, url }) => {   const [[name, value]] = Object.entries(item) ...   const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach(({ dataset }) => {         const { name, id } = dataset         dispatch(updateStarship({ value, fieldName: name, url: id }))       })     } else {       dispatch(updateStarship({ value, fieldName: name, url }))     }    }   return (   ...    &lt;input         value={value}         onChange={updateHandler}         type=\"text\" \/>     ...       &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u043a\u0430 Selectable \u0432\u0435\u0448\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u043a\u043b\u0430\u0441\u0441 <code>ui-selected<\/code>. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 <code>ui-selectable<\/code> \u043a\u0430\u0436\u0434\u043e\u043c\u0443 DOM \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d. \u0414\u043e\u0431\u0430\u0432\u0438\u043c <code>data-<\/code> \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b <code>id<\/code> \u0438 <code>name<\/code> \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u0439\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ item, url }) => { ...   const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach(({ dataset }) => {         const { name, id } = dataset         dispatch(updateStarship({ value, fieldName: name, url: id }))       })     } else {       dispatch(updateStarship({ value, fieldName: name, url }))     }    }   return (   ...    &lt;input         value={value}         onChange={updateHandler}         type=\"text\" \/> ...       &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 starships-reducer.js \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>updateStarship<\/code> :<\/p>\n<pre><code class=\"javascript\">\/\/ starships-reducer.js  import { createSlice } from '@reduxjs\/toolkit';  export const starshipsSlice = createSlice({ ... reducers: { ...       updateStarship: (state, action) => {       const { value, fieldName, url } = action.payload       const updatingItem = state.starships.find(starship => starship.url === url);       const updatingIndex = state.starships.findIndex(starship => starship.url === url);         if (updatingIndex &lt; 0) {         throw new Error(`no such index`);       }                updatingItem[fieldName] = value;              state.starships = [         ...state.starships.slice(0, updatingIndex),         updatingItem,         ...state.starships.slice(updatingIndex + 1),       ]      } }   ...<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0430\u043f\u0434\u0435\u0439\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d5\/7c6\/493\/3d57c6493c2fb5161b29d69513dbbb12.gif\" width=\"600\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3d5\/7c6\/493\/3d57c6493c2fb5161b29d69513dbbb12.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. \u0412\u044b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b! <\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/2\/commits\/b2e4bc47b95cd7cd06ccae99ee3f582c825de301\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<p>\u041d\u043e \u043f\u043e\u0447\u0442\u0438&#8230; \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u0418, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u044d\u0442\u043e \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e &#8212; \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u0430\u0441 \u0436\u0434\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041c\u043d\u0435 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0430\u043f\u0434\u0435\u0439\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 23&#215;200, \u0442.\u0435. \u0432 DOM \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u043e\u0434\u043d\u043e\u043c\u043e\u043c\u0435\u043d\u0442\u043d\u043e 4600 \u044f\u0447\u0435\u0435\u043a. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0444\u0440\u0438\u0437\u044b \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u043e. \u0418 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0432\u0440\u043e\u0434\u0435 <code>react-window<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 DOM \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a. \u0410 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0434\u0432\u0443\u0445\u0441\u043e\u0442 \u0441\u0442\u0440\u043e\u043a, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436\u0435 \u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0439: \u0445\u0438\u0442\u0440\u044b\u0439<\/h2>\n<p>\u042f \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u043b \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441\u0430 \u0438 \u043d\u0430 \u0443\u043c \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u0451\u043b \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430\u0441 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043a\u0442\u0430. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u044d\u0442\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0430\u043f\u0434\u0435\u0439\u0442\u0430 \u0441\u0442\u0435\u0439\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u043f\u0434\u0435\u0439\u0442\u0430 \u0432 TableCell<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ url, item }) => {   ...      const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach((item) => {         const input = item.children[0];         input.value = value;       })     }      setState(value)    }    return (     ...   ) }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 &#8212; \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a \u0447\u0435\u0440\u0435\u0437 <code>input.value<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u043e \u0441\u0442\u0435\u0439\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa2\/0c8\/bda\/aa20c8bda1a0b0d290e81eaf18f502b8.gif\" width=\"600\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa2\/0c8\/bda\/aa20c8bda1a0b0d290e81eaf18f502b8.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e \u0441\u0442\u0435\u0439\u0442\u043e\u043c \u044f\u0447\u0435\u0435\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bf4\/d70\/40b\/bf4d7040be69cb07afa4866608155f0c.gif\" width=\"600\" height=\"319\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bf4\/d70\/40b\/bf4d7040be69cb07afa4866608155f0c.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 React, \u043d\u043e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043d \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c.<\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/3\/commits\/5977e204cfd01f439845b2af9d3bf9b337774b7d\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u0440\u0435\u0442\u0438\u0439: \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u043d\u044b\u0439<\/h2>\n<p>\u041c\u043e\u0437\u0433 &#8212; \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430. \u041c\u043e\u0436\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e \u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043d\u0430 \u0443\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442, \u0442\u044b \u0441\u043b\u043e\u0432\u043d\u043e \u0432 \u0441\u0442\u0435\u043d\u0443 \u0443\u043f\u0438\u0440\u0430\u0435\u0448\u044c\u0441\u044f, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442. \u041d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0432\u043b\u0435\u0447\u044c\u0441\u044f, \u043f\u043e\u0439\u0442\u0438 \u043d\u0430 \u043f\u0440\u043e\u0433\u0443\u043b\u043a\u0443, \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438 &#8212; \u043c\u043e\u0437\u0433 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 &#171;\u042d\u0432\u0440\u0438\u043a\u0430&#187; &#8212; \u043e\u043d \u0432\u044b\u043f\u043b\u0451\u0432\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435. \u0422\u0430\u043a\u043e\u0435 \u0441\u043e \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437, \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u0432 \u044d\u0442\u043e\u0442. \u0421\u0435\u0439\u0447\u0430\u0441 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0441\u0432\u043e\u0451 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c redux-store:<\/p>\n<pre><code class=\"javascript\">\/\/ starships-reducer.js  export const starshipsSlice = createSlice({   name: 'starships',   initialState: {     ...     \/\/ \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438     cargo_capacity: [],     cost_in_credits: [],     max_atmosphering_speed: [],     name: [],   },   reducers: { ...     \/\/ \u043a\u043b\u0430\u0434\u0451\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0438     setItemsList: (state, action) => {        const {listName, list} = action.payload       state[listName] = list     },   }, }) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 App \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">\/\/ app.jsx  const App = () => { ...    useEffect(() => {     if (!starships) {       const getNews = async () => {         const { data } = await axios({           method: `get`,           url: `http:\/\/swapi.dev\/api\/vehicles`         })          const { results } = data         dispatch(setStarships(results));          \/\/ \u043f\u0443\u0441\u0442\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b         let cargo_capacity = [];         let cost_in_credits = [];         let max_atmosphering_speed = [];         let name = [];          \/\/ \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u0435\u0439 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f         \/\/ \u0432\u0430\u0436\u043d\u043e: \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c url \u043a\u0430\u043a \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440         for (const starship of results) {           cargo_capacity.push({             url: starship.url,             value: starship.cargo_capacity           })           cost_in_credits.push({             url: starship.url,             value: starship.cost_in_credits           })           max_atmosphering_speed.push({             url: starship.url,             value: starship.max_atmosphering_speed           })           name.push({             url: starship.url,             value: starship.name           })         };          \/\/ \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u0440         dispatch(setItemsList({ listName: `cargo_capacity`, list: cargo_capacity }))         dispatch(setItemsList({ listName: `cost_in_credits`, list: cost_in_credits }))         dispatch(setItemsList({ listName: `max_atmosphering_speed`, list: max_atmosphering_speed }))         dispatch(setItemsList({ listName: `name`, list: name }))       }        getNews();     }   }, [starships])    return ( ...   ); }  export default App; <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 TableCell. \u0412 \u043f\u0440\u043e\u043f\u0441\u044b \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c <code>index<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0435.<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ url, item, index }) => {   const dispatch = useDispatch();   \/\/ \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430   const [name] = Object.keys(item)    \/\/ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0445\u0438\u0442\u0440\u044b\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440. \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442,   \/\/ \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435   const itemValue = useSelector(({ starships }) => starships[name][index]);    const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach(({ dataset }) => {         const { id, name } = dataset;                  \/\/ \u0432\u043e \u0432\u0441\u0435\u0445 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0442\u0435\u0439\u0442, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0442\u0443\u0434\u0430          \/\/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 url \u043a\u0430\u043a \u0438\u043d\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440         dispatch(updateItem({ value, listName: name, url: id }));       })     } else {       dispatch(updateItem({ value, listName: name, url }));     }   }     return (     &lt;div       data-id={url}       data-name={name}       className=\"table__cell ui-selectable\">       &lt;input         \/\/ \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0442\u0435\u0439\u0442\u0430,         \/\/ \u0431\u0435\u0440\u0451\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0441\u0442\u043e\u0440\u0430         value={itemValue ? itemValue.value : `loading...`}         onChange={updateHandler}         type=\"text\" \/>     &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0434\u044c\u044e\u0441\u0435\u0440\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435:<\/p>\n<pre><code class=\"javascript\">\/\/ starships-reducer.js  export const starshipsSlice = createSlice({   name: 'starships',   initialState: {     ...   },   reducers: {     ... updateItem: (state, action) => {       \/\/ \u0434\u043e\u0441\u0442\u0430\u0451\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 url       const { value, listName, url } = action.payload        const updatingItem = state[listName]         .find(listItem => listItem.url === url);        const updatingIndex = state[listName]         .findIndex(listItem => listItem.url === url);        if (updatingIndex &lt; 0) {         throw new Error(`no such index`);       }        updatingItem.value = value;        state[listName] = [         ...state[listName].slice(0, updatingIndex),         updatingItem,         ...state[listName].slice(updatingIndex + 1),       ]     },   }, }) <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f55\/bf6\/bca\/f55bf6bca495abf05b31be478b410c4d.gif\" alt=\"\" title=\"\" width=\"600\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f55\/bf6\/bca\/f55bf6bca495abf05b31be478b410c4d.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445: \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 &#8212; \u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 TableCell:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ url, item, index }) => { ...      const updateHandler = ({ target }) => { ...      if (selectedFields.length) {       selectedFields.forEach(({ dataset }) => {         const { id, name: listName } = dataset;                  \/\/ \u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439         \/\/ \u044f\u0447\u0435\u0439\u043a\u0438 \u0441\u043f\u0438\u0441\u043a\u0443 \u044f\u0447\u0435\u0439\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435         if (listName === name) {           dispatch(updateItem({ value, listName, url: id }));         }       })     } else {       dispatch(updateItem({ value, listName: name, url }));     }   }     return ( ...   ) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/79d\/2ea\/f2a\/79d2eaf2ac8231886602b0f35765fee4.gif\" width=\"600\" height=\"259\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/79d\/2ea\/f2a\/79d2eaf2ac8231886602b0f35765fee4.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b!<\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/4\/commits\/fc1f3545cf95b10fde881e2b1031727bf8e79779\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e \u0442\u0435\u043c\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430. \u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438 7 \u043c\u0435\u0441\u044f\u0446\u0435\u0432, \u0434\u043e\u043b\u0433\u043e \u0438\u0441\u043a\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u0451\u043b, \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u0416\u0434\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u0442\u0438\u043a\u0438 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e &#8212; \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0438 \u044f \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0433\u0434\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043e\u0431\u0438\u0440\u0430\u044e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0445 \u0441\u0442\u0440\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/586526\/\"> https:\/\/habr.com\/ru\/articles\/586526\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435: \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u043e\u0444\u043e\u0440\u043c\u0438\u043c?<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>npx create-react-app<\/code><\/p>\n<p>\u0412 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 app.js \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u0440\u0430\u0431\u043b\u0435\u0439 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0438\u0445 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 redux (\u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0443\u0434\u0430):<\/p>\n<pre><code class=\"javascript\">\/\/ app.jsx  const App = () => {   const dispatch = useDispatch();    useEffect(() => {     const getNews = async () => {       const {data} = await axios({         method: `get`,         url: `http:\/\/swapi.dev\/api\/vehicles`       })        dispatch(setStarships(data.results))     }     getNews();   }, [])    return (     &lt;div className=\"App\">       &lt;Table \/>     &lt;\/div>   ); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<pre><code class=\"javascript\">\/\/ table.jsx  const Table = () => {   const starships = useSelector(({ starships }) => starships.starships);    return (     starships       ? &lt;div className=\"table\">         &lt;TableHeader \/>         {starships.map((starship, idx) => &lt;TableRow key={idx} starship={starship} \/>)}       &lt;\/div>       : &lt;div>loading...&lt;\/div>   ) };<\/code><\/pre>\n<p>\u0421\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<pre><code class=\"javascript\">\/\/ table-row.jsx  const TableRow = ({starship}) => {   const {     cargo_capacity,     cost_in_credits,     max_atmosphering_speed,     name   } = starship     return (     &lt;div className=\"table__row\">       &lt;TableCell item={cargo_capacity} \/>       &lt;TableCell item={cost_in_credits} \/>       &lt;TableCell item={max_atmosphering_speed} \/>       &lt;TableCell item={name} \/>     &lt;\/div>   ) };<\/code><\/pre>\n<p>\u042f\u0447\u0435\u0439\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ item }) => {   const [state, setState] = useState(item);    return (     &lt;div className=\"table__cell\">       &lt;input         value={state}         onChange={({ target }) => setState(target.value)}         type=\"text\" \/>     &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u0442\u0435\u0439\u0442\u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430, \u044f\u0447\u0435\u0439\u043a\u0430 \u043c\u044b \u043a\u043b\u0430\u0434\u0451\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u043e\u043f\u0441\u043e\u0432 \u0432 \u0441\u0442\u0435\u0439\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0433\u043e. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044f\u0447\u0435\u0439\u043a\u0435, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438. (\u0414\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 flash updates, \u044f \u0443\u0431\u0440\u0430\u043b <code>outline<\/code> \u0443 <code>input<\/code> \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 <code>:focus<\/code>, \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0430\u043a!)<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0412\u044b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b! <\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/1\/commits\/7ba67a08a91570202fdd9df6d6fe8d075b3c8b04\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<h2>\u041c\u0430\u0441\u0441\u043e\u0432\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u0439\u0442\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044f\u0447\u0435\u0435\u043a \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e? \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a\u0430\u043a \u0432 google sheets \u0438 \u0447\u0442\u043e\u0431\u044b \u0435\u0449\u0451 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e? \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/mobius1.github.io\/Selectable\/index.html\" rel=\"noopener noreferrer nofollow\">https:\/\/mobius1.github.io\/Selectable\/index.html<\/a><\/p>\n<p><code>npm i selectable.js<\/code><\/p>\n<p>\u0412 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 Table \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 selectable<\/p>\n<pre><code class=\"javascript\">\/\/ table.jsx  const Table = ({ starships }) => {    const escKeyDownHandler = useCallback((evt) => {     if (evt.key === `Escape` || evt.key === `Esc`) {       evt.preventDefault();       window.select.clear();     }   }, [])  useEffect(() => {      window.select = new Selectable({       appendTo: `.table`,       autoRefresh: false,       lasso: {         border: '1px solid blue',         backgroundColor: 'rgba(52, 152, 219, 0.1)',       },        ignore: [         `input`       ],     })    }, []);    useEffect(() => {     document.addEventListener(`keydown`, (evt) => escKeyDownHandler(evt));     return document.removeEventListener(`keydown`, escKeyDownHandler);   }, [escKeyDownHandler]);      return (   ...       ) };<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 ignore <code>input<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0444\u043e\u043a\u0443\u0441\u0435 \u0432 \u043d\u0451\u043c, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e. \u0422\u0430\u043a\u0436\u0435 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430 <code>esc<\/code> \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043d\u0430 \u044d\u0442\u0443 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u043e\u0441\u044c.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043f\u0435\u0447\u0430\u0442\u0430\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u044f\u0447\u0435\u0439\u043a\u0430\u0445. \u041d\u043e \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c? \u0412 React \u043e\u0434\u043d\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0431\u0451\u043d\u043a\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u0439\u0442\u0430 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u044c \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u043f\u0434\u0435\u0439\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 redux, \u0447\u0442\u043e \u043c\u044b \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0435\u0440\u0432\u044b\u0439. \u0421\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043f\u0440\u043e\u043f\u0441\u043e\u0432 \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 TableCell<\/p>\n<p>\u0411\u044b\u043b\u043e:<\/p>\n<pre><code class=\"javascript\">&lt;TableCell item={cargo_capacity} \/><\/code><\/pre>\n<p>\u0421\u0442\u0430\u043b\u043e:<\/p>\n<pre><code class=\"javascript\">&lt;TableCell url={url} item={{cargo_capacity}} \/><\/code><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0438\u043c\u044f \u044f\u0447\u0435\u0439\u043a\u0438 \u0438 url \u043a\u0430\u043a \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0442\u0440\u043e\u0447\u043a\u0438<\/p>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 TableCell:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ item, url }) => {   const [[name, value]] = Object.entries(item) ...   const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach(({ dataset }) => {         const { name, id } = dataset         dispatch(updateStarship({ value, fieldName: name, url: id }))       })     } else {       dispatch(updateStarship({ value, fieldName: name, url }))     }    }   return (   ...    &lt;input         value={value}         onChange={updateHandler}         type=\"text\" \/>     ...       &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u043a\u0430 Selectable \u0432\u0435\u0448\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u043a\u043b\u0430\u0441\u0441 <code>ui-selected<\/code>. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 <code>ui-selectable<\/code> \u043a\u0430\u0436\u0434\u043e\u043c\u0443 DOM \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d. \u0414\u043e\u0431\u0430\u0432\u0438\u043c <code>data-<\/code> \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b <code>id<\/code> \u0438 <code>name<\/code> \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u0439\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ item, url }) => { ...   const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach(({ dataset }) => {         const { name, id } = dataset         dispatch(updateStarship({ value, fieldName: name, url: id }))       })     } else {       dispatch(updateStarship({ value, fieldName: name, url }))     }    }   return (   ...    &lt;input         value={value}         onChange={updateHandler}         type=\"text\" \/> ...       &lt;\/div>   ) }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 starships-reducer.js \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>updateStarship<\/code> :<\/p>\n<pre><code class=\"javascript\">\/\/ starships-reducer.js  import { createSlice } from '@reduxjs\/toolkit';  export const starshipsSlice = createSlice({ ... reducers: { ...       updateStarship: (state, action) => {       const { value, fieldName, url } = action.payload       const updatingItem = state.starships.find(starship => starship.url === url);       const updatingIndex = state.starships.findIndex(starship => starship.url === url);         if (updatingIndex &lt; 0) {         throw new Error(`no such index`);       }                updatingItem[fieldName] = value;              state.starships = [         ...state.starships.slice(0, updatingIndex),         updatingItem,         ...state.starships.slice(updatingIndex + 1),       ]      } }   ...<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0430\u043f\u0434\u0435\u0439\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. \u0412\u044b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b! <\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/2\/commits\/b2e4bc47b95cd7cd06ccae99ee3f582c825de301\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<p>\u041d\u043e \u043f\u043e\u0447\u0442\u0438&#8230; \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u0418, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u044d\u0442\u043e \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e &#8212; \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u0430\u0441 \u0436\u0434\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041c\u043d\u0435 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0430\u043f\u0434\u0435\u0439\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 23&#215;200, \u0442.\u0435. \u0432 DOM \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u043e\u0434\u043d\u043e\u043c\u043e\u043c\u0435\u043d\u0442\u043d\u043e 4600 \u044f\u0447\u0435\u0435\u043a. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0444\u0440\u0438\u0437\u044b \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u043e. \u0418 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0432\u0440\u043e\u0434\u0435 <code>react-window<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 DOM \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a. \u0410 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0434\u0432\u0443\u0445\u0441\u043e\u0442 \u0441\u0442\u0440\u043e\u043a, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436\u0435 \u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u044f\u0447\u0435\u0435\u043a.<\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u0442\u043e\u0440\u043e\u0439: \u0445\u0438\u0442\u0440\u044b\u0439<\/h2>\n<p>\u042f \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u043b \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u0435\u0437 \u043f\u043e\u0442\u0435\u0440\u0438 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441\u0430 \u0438 \u043d\u0430 \u0443\u043c \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u0451\u043b \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043d\u0430\u0441 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0440\u0435\u0430\u043a\u0442\u0430. \u042d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u044d\u0442\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0430\u043f\u0434\u0435\u0439\u0442\u0430 \u0441\u0442\u0435\u0439\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0430\u043f\u0434\u0435\u0439\u0442\u0430 \u0432 TableCell<\/p>\n<pre><code class=\"javascript\">\/\/ table-cell.jsx  const TableCell = ({ url, item }) => {   ...      const updateHandler = ({ target }) => {     const { value } = target;     const selectedFields = document.querySelectorAll(`.ui-selected`);      if (selectedFields.length) {       selectedFields.forEach((item) => {         const input = item.children[0];         input.value = value;       })     }      setState(value)    }    return (     ...   ) }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 &#8212; \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u044f\u0447\u0435\u0435\u043a \u0447\u0435\u0440\u0435\u0437 <code>input.value<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u043e \u0441\u0442\u0435\u0439\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e \u0441\u0442\u0435\u0439\u0442\u043e\u043c \u044f\u0447\u0435\u0435\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 React, \u043d\u043e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043d \u0431\u044b\u043b \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c.<\/p>\n<p><a href=\"https:\/\/github.com\/Makemanback\/react-table\/pull\/3\/commits\/5977e204cfd01f439845b2af9d3bf9b337774b7d\" rel=\"noopener noreferrer nofollow\">Github \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a<\/a><\/p>\n<h2>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0442\u0440\u0435\u0442\u0438\u0439: \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u043d\u044b\u0439<\/h2>\n<p>\u041c\u043e\u0437\u0433 &#8212; \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430. \u041c\u043e\u0436\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e \u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043d\u0430 \u0443\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442, \u0442\u044b \u0441\u043b\u043e\u0432\u043d\u043e \u0432 \u0441\u0442\u0435\u043d\u0443 \u0443\u043f\u0438\u0440\u0430\u0435\u0448\u044c\u0441\u044f, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442. \u041d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0432\u043b\u0435\u0447\u044c\u0441\u044f, \u043f\u043e\u0439\u0442\u0438 \u043d\u0430 \u043f\u0440\u043e\u0433\u0443\u043b\u043a\u0443, \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438 &#8212; \u043c\u043e\u0437\u0433 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 &#171;\u042d\u0432\u0440\u0438\u043a\u0430&#187; &#8212; \u043e\u043d \u0432\u044b\u043f\u043b\u0451\u0432\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435. \u0422\u0430\u043a\u043e\u0435 \u0441\u043e \u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437, \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u0432 \u044d\u0442\u043e\u0442. \u0421\u0435\u0439\u0447\u0430\u0441 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0441\u0432\u043e\u0451 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c redux-store:<\/p>\n<pre><code class=\"javascript\">\/\/ starships-reducer.js  export const starshipsSlice = createSlice({   name: 'starships',   initialState: {     ...     \/\/ \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438     cargo_capacity: [],     cost_in_credits: [],     max_atmosphering_speed: [],     name: [],   },   reducers: { ...     \/\/ \u043a\u043b\u0430\u0434\u0451\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0438     setItemsList: (state, action) => {        const {listName, list} = action.payload       state[listName] = list     },   }, }) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 App \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">\/\/ app.jsx  const App = () => { ...    useEffect(() => {     if (!starships) {       const getNews = async () => {         const { data } = await axios({           method: `get`,           url: `http:\/\/swapi.dev\/api\/vehicles`         })          const { results } = data         dispatch(setStarships(results));          \/\/ \u043f\u0443\u0441\u0442\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b         let cargo_capacity = [];         let cost_in_credits = [];         let max_atmosphering_speed = [];         let name = [];          \/\/ \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c\u0441\u044f \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u043a\u043e\u0440\u0430\u0431\u043b\u0435\u0439 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f         \/\/ \u0432\u0430\u0436\u043d\u043e: \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c url \u043a\u0430\u043a \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440         for (const starship of results) {           cargo_capacity.push({             url: starship.url,             value: starship.cargo_capacity           })           cost_in_credits.push({             url: starship.url,             value:<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-403251","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/403251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=403251"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/403251\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=403251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=403251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=403251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}