react textarea onchange focus change

Solutions on MaxInterview for react textarea onchange focus change by the best coders in the world

showing results for - "react textarea onchange focus change"
Nick
28 Jan 2016
1it is because you are rendering the form in a function inside render().
2
3Every time your state/prop change, the function returns a new form. it caused you to lose focus.
4
5Try putting what's inside the function into your render directly.
6
7       <main id="main" role="main">
8            <div className="container-fluid">
9                <FormPostSingle />
10            </div>
11        </main>
12====>
13
14       <main id="main" role="main">
15            <div className="container-fluid">
16                <form onSubmit={onSubmit}>
17                    <InputText name="title" label="Title" placeholder="Enter a title" onChange={onChange} value={valueTitle} />
18                    <InputSubmit name="Save" />
19                </form>
20            </div>
21        </main>