user1883050 user1883050 - 1 month ago 9
React JSX Question

why is this button to the right of this other button, why not to the left?

In this JSBin:,output

Why is the "Tweet button" to the right of the "Add Photo" button. Per the code below, I believe it should be to the left?

<button className="btn btn-primary pull-right"
disabled={this.state.text.length === 0 && !this.state.photoAdded}>Tweet
<button className="btn btn-default pull-right"
{this.state.photoAdded ? "✓ Photo Added" : "Add Photo" }


You are using the pull-right class which is essentially float:right and that's how it works.

It stacks the elements in inverted order of their occurence.

Since, Tweet occured before Add Photo, it got floated to the right, and then add photo followed.

You could read up the CSS Spec here:

Or this SO answer for more info on how float works.