{"id":410608,"date":"2024-06-29T21:29:08","date_gmt":"2024-06-29T21:29:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=410608"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=410608","title":{"rendered":"<span>\u041a\u0440\u043e\u0448\u0435\u0447\u043d\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f react-dnd<\/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<p>\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e drag-and-drop.<\/p>\n<p>\u0411\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <strong>react-dnd<\/strong>, \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0435\u0451 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430 \u0432\u0445\u043e\u0434\u0430.<\/p>\n<p>\u0424\u0438\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e \u043b\u0438\u0431\u044b \u0438 \u0434\u0432\u0443\u0445 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><strong>DndContainer<\/strong> &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043e\u0431\u0451\u0440\u0442\u043a\u0430, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u043d\u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b react-dnd<\/p>\n<\/li>\n<li>\n<p><strong>DropTarget<\/strong> &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 drag-and-drop \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u0440\u0435\u0446\u0435\u043f\u0442!<\/p>\n<h3>react-dnd<\/h3>\n<ul>\n<li>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f: <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/about\" rel=\"noopener noreferrer nofollow\">react-dnd<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/examples\/other\/native-files\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437<\/a> \u0438 <a href=\"https:\/\/codesandbox.io\/s\/react-dnd-file-upload-fywjwh\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0451 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0438\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h3>DndContainer<\/h3>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0432 children \u043d\u0430\u0448 \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 DropTarget.<\/p>\n<pre><code class=\"typescript\">import React from 'react';  import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend';  import DropTarget from '..\/drop-target';  const DndContainer = (props: {   onDrop: (files: File[]) => void;   disabled: boolean;   title?: string;   hoverTitle?: string; }) => {   const {     onDrop,     disabled,     title = '\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044e\u0434\u0430 \u0444\u0430\u0439\u043b\u044b',     hoverTitle = '\u041e\u0442\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438',   } = props;    return (     &lt;DndProvider backend={HTML5Backend}>       &lt;DropTarget         onDrop={onDrop}         disabled={disabled}         title={title}         hoverTitle={hoverTitle}       \/>     &lt;\/DndProvider>   ); };  export default DndContainer; <\/code><\/pre>\n<h3>DropTarget<\/h3>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 drag-and-drop \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/p>\n<pre><code class=\"typescript\">import React from 'react';  import { useDrop } from 'react-dnd'; import { NativeTypes } from 'react-dnd-html5-backend';  import Styles from '.\/index.css';  const DropTarget = (props: {   onDrop: (files: File[]) => void;   disabled: boolean;   title: string;   hoverTitle: string; }) => {   const { onDrop, disabled, title, hoverTitle } = props;   const [{ canDrop, isOver }, drop] = useDrop(     () => ({       accept: [NativeTypes.FILE],       drop: (item: { files: File[] }) => {         onDrop(item.files);       },       canDrop: () => !disabled,       collect: (monitor) => ({         isOver: monitor.isOver(),         canDrop: monitor.canDrop(),       }),     }),     [onDrop]   );   const isActive = canDrop &amp;&amp; isOver;    return (     &lt;div ref={drop} className={Styles.wrapper} data-disabled={disabled}>       &lt;div className={Styles.dropTarget} data-active={isActive}>         {isActive ? hoverTitle : title}       &lt;\/div>     &lt;\/div>   ); };  export default DropTarget; <\/code><\/pre>\n<p>\u0421\u0442\u0438\u043b\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435, \u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044e:<\/p>\n<pre><code class=\"css\">.wrapper {   position: relative; } .wrapper[data-disabled='true'] {   cursor: not-allowed; } .wrapper[data-disabled='true']::after {   content: '';   position: absolute;   top: 0;   left: 0;   bottom: 0;   right: 0;   background-color: rgba(255, 255, 255, 0.35); }  .dropTarget {   display: flex;   justify-content: center;   align-items: center;   padding: 40px 20px;   margin: 20px 0;   border: 1px dashed black;   border-radius: 5px;   user-select: none;   color: black; }  .dropTarget[data-active='true'] {   border: 1px dashed #0022f5;   color: #0022f5; } <\/code><\/pre>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u0430\u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442:<\/p>\n<pre><code class=\"typescript\">type Props = {   handleFilesDrop: (files: File[]) => void;   title?: string; } const DnD = (props: Props) => {   const { handleFilesDrop, title = '\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044e\u0434\u0430 \u043c\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043b\u044b' } = props;    const shouldBeDisabled = \/* some condition, based on state\/props or whatever you need *\/;    return (     &lt;div className={Styles.dnd}>       &lt;DndContainer         title={title}         onDrop={handleFilesDrop}         disabled={shouldBeDisabled}       \/>     &lt;\/div>   ); }; <\/code><\/pre>\n<h3>\u0418\u0442\u043e\u0433\u043e<\/h3>\n<p>\u0412\u044b\u0432\u043e\u0434\u043e\u0432 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442\u0438\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0435\u0442\u0430\u043f\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 dnd \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438))<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u0447\u0438 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0430\u0448\u0438\u0445 dnd \u0444\u0438\u0447)<\/p>\n<p>PS: \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/about\" rel=\"noopener noreferrer nofollow\">react-dnd<\/a><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/examples\/other\/native-files\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437<\/a> \u0438 <a href=\"https:\/\/codesandbox.io\/s\/react-dnd-file-upload-fywjwh\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a><\/p>\n<\/li>\n<\/ul>\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\/732742\/\"> https:\/\/habr.com\/ru\/articles\/732742\/<\/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<p>\u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0437\u0430\u0434\u0430\u0447\u0430 &#8212; \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e drag-and-drop.<\/p>\n<p>\u0411\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <strong>react-dnd<\/strong>, \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0435\u0451 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0438\u0437\u043a\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430 \u0432\u0445\u043e\u0434\u0430.<\/p>\n<p>\u0424\u0438\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e \u043b\u0438\u0431\u044b \u0438 \u0434\u0432\u0443\u0445 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><strong>DndContainer<\/strong> &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043e\u0431\u0451\u0440\u0442\u043a\u0430, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u043d\u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b react-dnd<\/p>\n<\/li>\n<li>\n<p><strong>DropTarget<\/strong> &#8212; \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 drag-and-drop \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u0440\u0435\u0446\u0435\u043f\u0442!<\/p>\n<h3>react-dnd<\/h3>\n<ul>\n<li>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f: <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/about\" rel=\"noopener noreferrer nofollow\">react-dnd<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/examples\/other\/native-files\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437<\/a> \u0438 <a href=\"https:\/\/codesandbox.io\/s\/react-dnd-file-upload-fywjwh\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0451 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0438\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h3>DndContainer<\/h3>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0432 children \u043d\u0430\u0448 \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 DropTarget.<\/p>\n<pre><code class=\"typescript\">import React from 'react';  import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend';  import DropTarget from '..\/drop-target';  const DndContainer = (props: {   onDrop: (files: File[]) => void;   disabled: boolean;   title?: string;   hoverTitle?: string; }) => {   const {     onDrop,     disabled,     title = '\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044e\u0434\u0430 \u0444\u0430\u0439\u043b\u044b',     hoverTitle = '\u041e\u0442\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438',   } = props;    return (     &lt;DndProvider backend={HTML5Backend}>       &lt;DropTarget         onDrop={onDrop}         disabled={disabled}         title={title}         hoverTitle={hoverTitle}       \/>     &lt;\/DndProvider>   ); };  export default DndContainer; <\/code><\/pre>\n<h3>DropTarget<\/h3>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 drag-and-drop \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/p>\n<pre><code class=\"typescript\">import React from 'react';  import { useDrop } from 'react-dnd'; import { NativeTypes } from 'react-dnd-html5-backend';  import Styles from '.\/index.css';  const DropTarget = (props: {   onDrop: (files: File[]) => void;   disabled: boolean;   title: string;   hoverTitle: string; }) => {   const { onDrop, disabled, title, hoverTitle } = props;   const [{ canDrop, isOver }, drop] = useDrop(     () => ({       accept: [NativeTypes.FILE],       drop: (item: { files: File[] }) => {         onDrop(item.files);       },       canDrop: () => !disabled,       collect: (monitor) => ({         isOver: monitor.isOver(),         canDrop: monitor.canDrop(),       }),     }),     [onDrop]   );   const isActive = canDrop &amp;&amp; isOver;    return (     &lt;div ref={drop} className={Styles.wrapper} data-disabled={disabled}>       &lt;div className={Styles.dropTarget} data-active={isActive}>         {isActive ? hoverTitle : title}       &lt;\/div>     &lt;\/div>   ); };  export default DropTarget; <\/code><\/pre>\n<p>\u0421\u0442\u0438\u043b\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435, \u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044e:<\/p>\n<pre><code class=\"css\">.wrapper {   position: relative; } .wrapper[data-disabled='true'] {   cursor: not-allowed; } .wrapper[data-disabled='true']::after {   content: '';   position: absolute;   top: 0;   left: 0;   bottom: 0;   right: 0;   background-color: rgba(255, 255, 255, 0.35); }  .dropTarget {   display: flex;   justify-content: center;   align-items: center;   padding: 40px 20px;   margin: 20px 0;   border: 1px dashed black;   border-radius: 5px;   user-select: none;   color: black; }  .dropTarget[data-active='true'] {   border: 1px dashed #0022f5;   color: #0022f5; } <\/code><\/pre>\n<h3>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u0430\u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442:<\/p>\n<pre><code class=\"typescript\">type Props = {   handleFilesDrop: (files: File[]) => void;   title?: string; } const DnD = (props: Props) => {   const { handleFilesDrop, title = '\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044e\u0434\u0430 \u043c\u0435\u0434\u0438\u0430\u0444\u0430\u0439\u043b\u044b' } = props;    const shouldBeDisabled = \/* some condition, based on state\/props or whatever you need *\/;    return (     &lt;div className={Styles.dnd}>       &lt;DndContainer         title={title}         onDrop={handleFilesDrop}         disabled={shouldBeDisabled}       \/>     &lt;\/div>   ); }; <\/code><\/pre>\n<h3>\u0418\u0442\u043e\u0433\u043e<\/h3>\n<p>\u0412\u044b\u0432\u043e\u0434\u043e\u0432 \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u0446\u0435\u043f\u0442\u0438\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0435\u0442\u0430\u043f\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 dnd \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438))<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u0447\u0438 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0430\u0448\u0438\u0445 dnd \u0444\u0438\u0447)<\/p>\n<p>PS: \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u043e <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/about\" rel=\"noopener noreferrer nofollow\">react-dnd<\/a><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/react-dnd.github.io\/react-dnd\/examples\/other\/native-files\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0437<\/a> \u0438 <a href=\"https:\/\/codesandbox.io\/s\/react-dnd-file-upload-fywjwh\" rel=\"noopener noreferrer nofollow\">\u0434\u0432\u0430<\/a><\/p>\n<\/li>\n<\/ul>\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\/732742\/\"> https:\/\/habr.com\/ru\/articles\/732742\/<\/a><br \/><\/br><\/br><\/p>\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-410608","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/410608","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=410608"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/410608\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=410608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=410608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=410608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}