Skip to content

Commit 6223b32

Browse files
authored
Update README.md
1 parent 70613c0 commit 6223b32

File tree

1 file changed

+0
-66
lines changed

1 file changed

+0
-66
lines changed

README.md

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ ReactDOM.render((
6565

6666
http://localhost:9001
6767

68-
online example: http://react-component.github.io/trigger/
69-
7068
## Development
7169

7270
```
@@ -252,75 +250,11 @@ npm start
252250

253251
```
254252
npm test
255-
npm run chrome-test
256-
```
257-
258-
## Coverage
259-
260-
```
261253
npm run coverage
262254
```
263255

264256
open coverage/ dir
265257

266-
## React 16 Note
267-
268-
After React 16, you won't access popup element's ref in parent component's componentDidMount, which means following code won't work.
269-
270-
```javascript
271-
class App extends React.Component {
272-
componentDidMount() {
273-
this.input.focus(); // error, this.input is undefined.
274-
}
275-
276-
render() {
277-
return (
278-
<Trigger
279-
action={['click']}
280-
popup={<div><input ref={node => this.input = node} type="text" /></div>}
281-
>
282-
<button>click</button>
283-
</Trigger>
284-
)
285-
}
286-
}
287-
```
288-
289-
Consider wrap your popup element to a separate component:
290-
291-
```javascript
292-
class InputPopup extends React.Component {
293-
componentDidMount() {
294-
this.props.onMount();
295-
}
296-
297-
render() {
298-
return (
299-
<div>
300-
<input ref={this.props.inputRef} type="text" />
301-
</div>
302-
);
303-
}
304-
}
305-
306-
class App extends React.Component {
307-
handlePopupMount() {
308-
this.input.focus(); // error, this.input is undefined.
309-
}
310-
311-
render() {
312-
return (
313-
<Trigger
314-
action={['click']}
315-
popup={<InputPopup inputRef={node => this.input = node} onMount={this.handlePopupMount} />}
316-
>
317-
<button>click</button>
318-
</Trigger>
319-
)
320-
}
321-
}
322-
```
323-
324258
## License
325259

326260
rc-trigger is released under the MIT license.

0 commit comments

Comments
 (0)