在获取内部的 API 响应后MenuItemDetail,我将其设置为responses状态,然后将其传递给 Tabs,然后传递给 TabContent。在这里,我想正确读取其 resp 和 name 属性,然后显示它们在两个相应编辑器中包含的任何内容,即 respEditor和nameEditor(resp以及name来自 API 的 json 中的字段)。
我可以从 API 中检索我的resp和name,但是当我尝试单击文本区域以添加或修改内容时,我得到了一个空白页面,并在控制台中收到此错误:
Uncaught TypeError: contentState.getBlockMap is not a function
Run Code Online (Sandbox Code Playgroud)
我在论坛上检查过这个问题:DraftJS - contentState.getBlockMap is not a function
我真的真的不知道为什么
const TabContent = ({ onChange, resp, , status }) => {
const [respEditor, setRespEditor] = useState(
EditorState.createWithContent(convertFromHTML(resp !== null ? resp : ""))
);
function respChange(state) {
setRespEditor(state);
onChange({
resp: …Run Code Online (Sandbox Code Playgroud) Apply当我单击(从下拉列表中应用所有选定的选项)或Cancel按钮(重置选定的选项)时,我无法进行多重交叉过滤。例如按taste和进行过滤availability(请参见图片)。但我无法呈现过滤后的行/更新的表。
export default function MenuDisplay() {
const { menuId } = useParams();
const { match } = JsonData;
const [selected, setSelected] = useState({});
const [hidden, setHidden] = useState({});
const [taste, setTaste] = useState([
{ label: "Good", value: "Good", name: "Good", selected: false },
{ label: "Medium", value: "Medium", name: "Medium", selected: false },
{ label: "Bad", value: "Bad", name: "Bad", selected: false }
]);
const [comments, setComments] = useState([
{ label: "0", value: …Run Code Online (Sandbox Code Playgroud)