
[英]How to use event handler with inside a styled component
注意:有一個 Index 組件和一個名稱也為 index 的 useState 變量。 不要混淆。 我希望每次單擊索引組件時,索引 useState 變量都會更新為該特定鍵值。上面的代碼將內聯事件處理程序應用於索引組件,但索引 state 變量在單擊時未正確更改。在控制台記錄索引一個字符串得到 o ...
[英]How to use event handler with inside a styled component
注意:有一個 Index 組件和一個名稱也為 index 的 useState 變量。 不要混淆。 我希望每次單擊索引組件時,索引 useState 變量都會更新為該特定鍵值。上面的代碼將內聯事件處理程序應用於索引組件,但索引 state 變量在單擊時未正確更改。在控制台記錄索引一個字符串得到 o ...
[英]No overload matches for this call, extra custom prop of styled component
此調用沒有重載匹配對於StyledContainer中的道具x, y ,它會拋出“此調用沒有重載匹配項”。 ...
[英]unable to properly render a react split-screen component using grid and styled-components
我剛剛學習了如何創建一個分屏(2 個屏幕)組件,該組件在父容器上使用“display: flex”,在其子容器上使用“flex: 1”來生成左組件和右組件。 現在我正在嘗試創建一個分屏(5 個屏幕)組件,它使用“顯示:網格”來生成 3 列和兩行,左側邊欄占據第一列,兩行和其他四個屏幕各占向上 1 列 ...
[英]How to inherit styles from another styled component and turning regular component into styled component at the same time?
我正在使用 StyledComponents 樣式框架,這是我的常規反應組件 我想通過調用 styled() function 將此組件轉換為樣式化組件,為此我已將 className 屬性附加到我的反應組件 (SelectButton) 的 DOM 元素。 但是我不想將 css 放在這個樣式組件 ...
[英]How can I add gradient to left and to right?
目標是向左和向右添加線性漸變。 我可以添加到右邊但不能同時添加 結果應該是這樣的 ...
[英]Can't pass props.style to "@emotion/styled" component
我正在使用情感風格的組件。 我有一個名為Layered的組件,我定義如下: 在我的主要代碼中,我創建了另一個名為<LayeredModified />的組件,它應該是Layered的,帶有一些額外的樣式。 樣式是: Layered本身永遠不會顯式呈現,只有LayeredModified ...
[英]MUI v5 (Styled, TypeScript) System props transmission error
剛開始學習Material ui遇到一個問題: 錯誤: TS2322: 類型 '{ children: string; 組件:字符串; 是字幕:字符串; }' 不可分配給類型 'IntrinsicAttributes & SystemProps & { align?: "righ ...
[英]Add local fonts to my react typescript package
我在 react js typescript 中創建了一個 npm package 並且我試圖將本地 fonts 添加到 package 但我不斷收到“找不到模塊”錯誤。 我的 package.json: tsconfig.json: } fonts.tsx 文件: App.tsx 文件: ...
[英]how to put order quantity above cart icon
你好,我試着把數字放在購物車圖標的左上角,但我沒有成功我正在嘗試獲得圖片中的結果enter image description here 這是我的代碼: ...
[英]Set Background Image using props in Styled Components
這是主頁組件。 我將詳細信息作為道具傳遞給主要組件 這是主要組成部分 文件結構(用於圖像路徑) 在此處輸入圖像描述我希望我作為道具傳遞的背景圖片可見。 使用上面的代碼后,它看起來像這樣在此處輸入圖像描述如您所見,圖像在后面不可見,但在檢查中您可以清楚地看到正確的 url 圖像在那里。 請幫忙。 ...
[英]How to style Material-UI's BottomNavigationAction, so the selected icon is a different color?
我需要一些幫助來解決我在使用 Material-UI 樣式組件時遇到的這個問題我正在嘗試使用 Material-UI v5 在 React 上創建一個 BottomNavigation 欄。 我希望欄中所選選項的圖標顯示特定顏色,比方說紅色 (#f00),未選擇的圖標顯示綠色 (#00f),為此我 ...
[英]Hover not working on the styled component
當我在 Wrapper 組件上輸入 hover 時,我希望左右箭頭可見。 但是沒有任何反應。 它與組件的重新渲染有什么關系嗎? 將鼠標懸停在 Wrapper 元素上時,我試圖使 LeftArrow 和 RightArrow 組件可見。 但是沒有任何反應。 請幫我。 ...
[英]How to make the icon rotated based on the prop?
如何根據 activeColor 屬性旋轉圖標? 當 activeColor 道具處於活動狀態時,我需要旋轉圖標。 到目前為止,我設法寫了這樣的東西,但它沒有用:(你能幫忙並就此提出建議嗎? 任何幫助將不勝感激。 問候, 艾米利亞 ...
[英]Nesting components in styled-components
我制作了這些組件: UserImg組件工作正常,但不顯示DropDown組件。 我希望顯示DropDown組件。 ...
[英]Not able to resolve 'tty' in node module
我在 ReactJs + 樣式組件中收到此錯誤。 我該如何解決?Compiled with problems: ERROR in ./node_modules/colorette/index.js 1:0-27 Module not found: Error: Can't resolve 't ...
[英]Property 'theme' does not exist on type 'IntrinsicAttributes'.ts(2322)
我是 TypeScript 的大三學生,我正在嘗試使用 styled-components 和自定義掛鈎在 TypeScript 中創建暗模式。 使用深色模式.tsx HeaderComponent.tsx 由於某種原因,我收到以下錯誤: 切換主題.tsx ...
[英]Using css variable with styled-compoents
我知道你可以用<ThemeProvider />包裝你的 React 應用程序,你可以為主題設置一個變量並像這樣訪問它: 但它是 CSS 本身具有可變特性嗎? 你可以做 可以混合使用嗎? 還是堅持使用樣式組件或 CSS? ...
[英]Change parent container color using CSS when grandchild input is expanded
我有一個 React 組件,其中容器是黃色的,但是當它的輸入字段展開時它應該是橙色的。 僅使用 CSS,可以在以下任一情況下更改outer-container背景顏色:a) 輸入寬度被擴展,或者 b) 輸入有焦點? 我試過了 但這不起作用,因為.outer-container:focus-withi ...
[英]nextjs13 and styledcomponent errors
您好,我們正在使用樣式化組件,在更新到 next.js 13 和 react 18 后,使用樣式化組件的下一個配置設置,我們得到了一些奇怪的行為。 擴展 styles 時 如果 styles 之間存在不匹配,我們有時會得到錯誤的樣式,但只有在我們構建並啟動項目時才會出現這種情況。 當我們運行 dev ...
[英]How to dynamically change theme using StyledComponents?
我有一個白標應用程序和兩個想要略有不同主題的終端客戶。 理想情況下,我不想在頂層傳遞主題,然后通過下面的所有各種組件。 有更好的方法嗎? 我的主題是動態的select嗎? 我可以讓主題全球可用嗎? 像 Tailwind CSS 這樣的東西會處理它的配置文件,如果是這樣,我該如何動態更改它? ...