Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Unhandled Rejection (Error): input is a void element tag and must neither have children

24.02.2021 (👁1097)


 

 

Error Message in React

×

Unhandled Rejection (Error): input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.

    in input (at Edit.js:109)

    in div (at Edit.js:99)

    in form (at Edit.js:98)

    in div (at Edit.js:87)

    in Edit (created by Context.Consumer)

    in Route (at App.js:22)

    in div (created by Container)

    in Container (at Layout.js:12)

    in div (at Layout.js:10)

 

Fehlerhafter React Code

//--< IsLoaded >--

< form className="submit-form">

<div>

<p>IDArticle:{this.state.idarticle}</p>

<input>{" " + this.state.title} </input>

..

 

Lösung:

Man darf in React in ein Input Form Feld nicht {this.state.variable} einfügen

 

<input type="text" name={title} value={title}/>

 

UND das <input /> tag muss mit einer schliessenden / Zeichen nur als ein-Tag mit Endung /> geschrieben werden

<input type="text" value={this.state.title} />

 

 

 

 

Lösung Code Beispiel:

return (

            //----< return >----     

            <div className="submit-form">

                {

                    //--< IsLoaded >--

                    <form className="submit-form">

                        <div>

                            <input type="hidden" value={this.state.idarticle} />

                            <input type="text" value={this.state.title} />

                           

                            <br/>

                            <button type="submit">Update</button>

                        </div>

                    </form>

                    //--</ IsLoaded >--

                }

            </div>

            //----</ return >----

        );