English 中文(简体)
部件上的推进剂及其类型
原标题:Accessing props and their types on a Component

因此,我对改写和打字体来说很新,而且有一个简单的问题,但似乎无法找到答案。

试图使用打字片,在以下几个字幕后,用无头的ui子ui:here

我正试图在以下构成部分中使用该推进剂:<代码><Tab>,称作s selected/code>,但由于被选定为无效,因此正在演变成问题?

the code:

<Tab
    className={({ selected }) => {
        classNames(
            "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-blue-700",
            "ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2",
            selected
                ? "bg-blue-50"
                : "bg-blue-100"
        );
    }}
></Tab>

文字汇编错误:

The expected type comes from property  className  which is declared here on type  IntrinsicAttributes & CleanProps<"button", TabPropsWeControl> & OurProps<"button", TabRenderPropArg> & { ...; } & { ...; } 

确信在界定类型方面存在着一些错误,但我甚至知道如何找到<条码>的类型:,P.S.的类别是<条码>的>,其中载明[],并填写<条码>。

问题回答

最终只是增加一份返回声明,并努力:

                            <Tab
                                key={tab}
                                className={({ selected }) => {
                                    return classNames(
                                        "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-blue-700",
                                        "ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2",
                                        selected
                                            ? "bg-blue-50"
                                            : "bg-blue-100"
                                    );
                                }}
                            >
                            </Tab>




相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...