We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b25d9e9 commit e0fc8b4Copy full SHA for e0fc8b4
stories/add_remove/controllable-order.tsx
@@ -30,9 +30,11 @@ export default class ControllableOrder extends React.Component {
30
}
31
32
add() {
33
- const order = [String(this.id), ...this.state.order];
+ const pos = ~~(Math.random() * this.state.list.length);
34
+ const order = [...this.state.order];
35
+ order.splice(pos, 0, String(this.id));
36
this.state.list.splice(
- ~~(Math.random() * this.state.list.length),
37
+ pos,
38
0,
39
<Pane key={this.id} defaultSize={{ width: '100%', height: 120 }} style={paneStyle}>
40
<p style={textStyle}>00{this.id++}</p>
0 commit comments