我有这段代码,我正在尝试使用 React-hook-form 连接Headless UI中的Combobox 组件。每当我尝试输入不同的值并选择不同的选项时,都会出现错误消息 -
Cannot read properties of undefined (reading 'name')
我尝试了很多不同的变体,但未能使用Comboboxwith register。任何帮助,将不胜感激。我想用它register来完成这项工作,并且不想使用其他Controller方法来实现react-hook-form.
import React from "react";
import { useState } from "react";
import { Combobox } from "@headlessui/react";
import { useForm } from "react-hook-form";
const people = [
{ id: 1, name: "Durward Reynolds" },
{ id: 2, name: "Kenton Towne" },
{ id: 3, name: "Therese Wunsch" },
{ id: 4, name: "Benedict …Run Code Online (Sandbox Code Playgroud) 我需要突出显示段落中的一些文本,但有一些限制 -
TLDR:我想要与下面链接的图片完全相同的东西。谢谢您的帮助。
这就是我所做的
<p class="introduction">
Hi so<span>This is what I did but not sure how to go from here</span></p>
Run Code Online (Sandbox Code Playgroud)
p.introduction {
width: 150px;
}
p.introduction span {
background-color: #f48024;
color: #1d1d1e;
border-radius: 25px;
float: left;
padding: 0 5px 0 5px;
}
Run Code Online (Sandbox Code Playgroud)