RZ
Size: a a a
RZ
a
АЧ
D
0
RZ
А
А
RZ
S
S
BB
BB
S
FT
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:1. версии реакта совпадают (16.13.1)
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
const MyComponent = ({ status }) => {транспилированный вариант:
const processing = useMemo(() => {
const res = ["new", "pending"].includes(status) ? 'processing' : 'stopped';
return res;
}, [status]);
return <h1>Hello from My Component: {processing}</h1>;
};
var MyComponent = function MyComponent(_ref) {3. я добавляю react в peerDependencies, в транспилированном скрипте выглядит так:
var status = _ref.status;
var processing = (0, _react.useMemo)(function () {
var res = ["new", "pending"].includes(status) ? 'processing' : 'stopped';
return res;
}, [status]);
return _react2.default.createElement(
"h1",
null,
"Hello from My Component: ",
processing
);
};
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
Т
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:1. версии реакта совпадают (16.13.1)
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
const MyComponent = ({ status }) => {транспилированный вариант:
const processing = useMemo(() => {
const res = ["new", "pending"].includes(status) ? 'processing' : 'stopped';
return res;
}, [status]);
return <h1>Hello from My Component: {processing}</h1>;
};
var MyComponent = function MyComponent(_ref) {3. я добавляю react в peerDependencies, в транспилированном скрипте выглядит так:
var status = _ref.status;
var processing = (0, _react.useMemo)(function () {
var res = ["new", "pending"].includes(status) ? 'processing' : 'stopped';
return res;
}, [status]);
return _react2.default.createElement(
"h1",
null,
"Hello from My Component: ",
processing
);
};
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
FT
FT
Т
Т