import React from 'react';
import { render } from 'react-dom';
const styles = {
display: 'flex',
justifyContent: 'center',
flexWrap: 'wrap',
};
const item = {
width: '26%',
}
const container = {
marginLeft: 'auto',
marginRight: 'auto',
width: '100%',
}
const App = () => (
<div style={container}>
<div style={styles}>
<div style={item}>test1</div>
<div style={item}>test2</div>
<div style={item}>test3</div>
<div style={item}>test4</div>
</div>
</div>
);
render(<App />, document.getElementById('root'));
Is there a way to make test4
appear under test1
, but still keep the items centralised to the parent container?
Changing justifyContent
to flex-start
would cause the entire flexbox to align to the left of the parent.