Home > Web Front-end > JS Tutorial > Use a very simple example to understand the idea of ​​react.js high-order components

Use a very simple example to understand the idea of ​​react.js high-order components

一个新手
Release: 2017-10-06 10:42:15
Original
1593 people have browsed it

Before debugging the code, I set up two caches

They are username and content

set in the console Two cache codes

localStorage.setItem('username','老王')
localStorage.setItem('content','类容')
Copy after login

Be sure to set these two caches before running the following code, because I encapsulated the public method in the high-order component and called the cache to the value of the input box

, the component returned by the higher-order component calls this method

'react''react-dom'.state={data:''==(event)=>=
            <Comp handBlur={.handBlur} data={.state.data}/> <input type="text" defaultValue={props.data} onBlur={props.handBlur}/> <textarea defaultValue={props.data}></textarea> <p>111</p>let LocalInput=local(Input,&#39;username&#39;=local(Textareas,&#39;content&#39;=<p>
                <form><LocalInput/>
                    类容 <LocalTextareas/>
                    <Localp></Localp>
                </form>
            </p><From></From>,document.querySelector("#root"))
Copy after login

The above is the detailed content of Use a very simple example to understand the idea of ​​react.js high-order components. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template