Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

voidEl breaks with: $ELEMENT is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.

オープン
#243 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react
領域
frontend

調査の方向性

voidEl、その Fable.React.Standard を通じた使用方法、および createElement の children パラメーターに対する ParamListAttribute から始めます。動作するケースと失敗するケースで生成された JavaScript を比較し、その後、空の children 引数なしで void 要素をレンダリングして React エラーがなくなったことを確認し、修正を検証します。

索引モデルが issue の本文から書いたものです。

説明

We recently upgraded from Fable.React 5.4.0 to 9.4.0, a rather large jump to be sure. An issue we now have is that rendering an element using either voidEl (either directly or indirectly via Fable.React.Standard) results in an error:

Uncaught Error: br is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.

Curiously, if I copy voidEl into my component and use that copy then it works. Digging a little deeper, I can see that it comes down to what JS is generated for each case. The working case generates:

react.createElement("br", {})

And the non-working case:

react.createElement("br", {}, [])

I assume the trailing empty array is triggering the error diagnostic because it is being interpreted as an attempt to assign zero children to the br, as opposed to not even attempting to assign any children.

I've got a feeling it has something to do with the ParamListAttribute on the children parameter to createElement, but not entirely sure why it manifests in one scenario and not the other.

主要言語
F#
スター
276
フォーク
65
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fable-compiler/fable-react のほかの issue

fable-compiler/fable-react の issue をすべて見る

似ている issue

Web Dev の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。