A more optimal way is to use the CSS / HTML features for this:
direction CSS property- Unicode characters
‏ / ‎ - Attach
.rtl / .ltr to body and use them to reorder
In this case, the order of your elements in HTML is the same for RTL and LTR. The difference in the applied CSS rules.
If you really need an element order in React, you can create your own component that changes the list of child elements if RTL:
const Dir = React.createClass({ render: function() { let children = (this.props.direction == 'rtl' && this.props.children && this.props.children.reverse) ? this.props.children.reverse() : null; return <div> { children } </div>; } });
source share