gajus / gajus/babel-plugin-react-css-modules
`createElement` and `cloneElement`
- 主要言語
- JavaScript
- スター
- 2k
- フォーク
- 159
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
There is currently no support for using `createElement` and `cloneElement` with the `styleName` attribute (as far as I've tried), which at times can be a bit painful.
```jsx
render() {
const element = ordered ? 'ol' : 'ul';
return React.createElement(
element,
{
styleName: 'example-style', // <-- This
},
);
}
```
-->
```
Warning: React does not recognize the `styleName` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `stylename` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
```
I haven't read through the source code but t would assume it is a transform thing, where the `styleName` prop is not read as it's not a JSX prop but rather a passed in as an object. JSX gets transformed into `createElement`s so I would've guessed that this would work automatically but I guess not, unless I'm doing something wrong here.
Wondering if there's any ability for future support?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、プラグインによる styleName の処理と、JSX 変換に関する既存のテストを見つけてください。React.createElement と React.cloneElement が props をどのように受け取るかを調査し、続いて、両方の API が styleName を変換し、DOM 要素に残さないことを示すテストを定義してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- babel, javascript, react
- 領域
- frontend, tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 30/100