Skip to content

Commit bad8176

Browse files
author
Jakub Drozdek
committed
Fix code formatting changes
1 parent 07dd6e8 commit bad8176

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

Diff for: content/docs/integrating-with-other-libraries.md

+29-14
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SomePlugin extends React.Component {
3434
}
3535
3636
render() {
37-
return <div ref={el => (this.el = el)} />;
37+
return <div ref={el => this.el = el} />;
3838
}
3939
}
4040
```
@@ -76,7 +76,7 @@ class Chosen extends React.Component {
7676
render() {
7777
return (
7878
<div>
79-
<select className="Chosen-select" ref={el => (this.el = el)}>
79+
<select className="Chosen-select" ref={el => this.el = el}>
8080
{this.props.children}
8181
</select>
8282
</div>
@@ -161,7 +161,7 @@ class Chosen extends React.Component {
161161

162162
componentDidUpdate(prevProps) {
163163
if (prevProps.children !== this.props.children) {
164-
this.$el.trigger('chosen:updated');
164+
this.$el.trigger("chosen:updated");
165165
}
166166
}
167167

@@ -177,7 +177,7 @@ class Chosen extends React.Component {
177177
render() {
178178
return (
179179
<div>
180-
<select className="Chosen-select" ref={el => (this.el = el)}>
180+
<select className="Chosen-select" ref={el => this.el = el}>
181181
{this.props.children}
182182
</select>
183183
</div>
@@ -216,11 +216,15 @@ function Button() {
216216
return <button id="btn">Przywitaj się</button>;
217217
}
218218

219-
ReactDOM.render(<Button />, document.getElementById('container'), function() {
219+
ReactDOM.render(
220+
<Button />,
221+
document.getElementById('container'),
222+
function() {
220223
$('#btn').click(function() {
221-
alert('Cześć!');
222-
});
223-
});
224+
alert('Cześć!');
225+
});
226+
}
227+
);
224228
```
225229

226230
Od tego momentu możesz zacząć przenosić coraz więcej logiki do samego komponentu i stosować coraz więcej praktyk reactowych. Przykładowo, w komponentach zwykle nie stosuje się identyfikatorów, ponieważ komponenty mogą być renderowane wielokrotnie. Zamiast tego możemy skorzystać z [reactowego systemu zdarzeń](/docs/handling-events.html) i podpiąć detektor zdarzeń bezpośrednio na reactowym elemencie `<button>`:
@@ -237,7 +241,10 @@ function HelloButton() {
237241
return <Button onClick={handleClick} />;
238242
}
239243
240-
ReactDOM.render(<HelloButton />, document.getElementById('container'));
244+
ReactDOM.render(
245+
<HelloButton />,
246+
document.getElementById('container')
247+
);
241248
```
242249

243250
[**Wypróbuj kod na CodePen**](https://codepen.io/gaearon/pen/RVKbvW?editors=1010)
@@ -264,7 +271,7 @@ const ParagraphView = Backbone.View.extend({
264271
remove() {
265272
ReactDOM.unmountComponentAtNode(this.el);
266273
Backbone.View.prototype.remove.call(this);
267-
},
274+
}
268275
});
269276
```
270277

@@ -388,7 +395,7 @@ function connectToBackboneModel(WrappedComponent) {
388395
delete propsExceptModel.model;
389396
return <WrappedComponent {...propsExceptModel} {...this.state} />;
390397
}
391-
};
398+
}
392399
}
393400
```
394401

@@ -412,11 +419,19 @@ function Example(props) {
412419
props.model.set('firstName', e.target.value);
413420
}
414421
415-
return <BackboneNameInput model={props.model} handleChange={handleChange} />;
422+
return (
423+
<BackboneNameInput
424+
model={props.model}
425+
handleChange={handleChange}
426+
/>
427+
);
416428
}
417429
418-
const model = new Backbone.Model({firstName: 'Staszek'});
419-
ReactDOM.render(<Example model={model} />, document.getElementById('root'));
430+
const model = new Backbone.Model({ firstName: 'Staszek' });
431+
ReactDOM.render(
432+
<Example model={model} />,
433+
document.getElementById('root')
434+
);
420435
```
421436

422437
[**Wypróbuj kod na CodePen**](https://codepen.io/gaearon/pen/PmWwwa?editors=0010)

0 commit comments

Comments
 (0)