I'm trying to add a button in the center in React using Functional component, but the button doesn't move to center. It's a simple task where I need to create a design.
//index.js
import React from 'react'
import ReactDOM from 'react-dom'
const subscribe = 'SUBSCRIBE'
const headerStyles = {
textAlign: 'center',
}
const Header = () => (
<header style={headerStyles}>
<div className='header-wrapper'>
<h2>{subscribe}</h2>
</div>
</header>
)
const mainStyles = {
textAlign: 'center',
padding: '10px 20px',
}
const Main = () => (
<main style={mainStyles}>
<div className='main-wrapper'>
<p>
Sign up with your email address to receive news and updates
</p><br></br><br></br>
<input name="firstname" placeholder="First name" />
<input name="lastname" placeholder="Last name" />
<input name="email" placeholder="Email" />
</div>
</main>
)
const buttonStyles = {
padding: '8px 50px',
background: 'rgb(255, 140, 0',
border: 'none',
borderRadius: 5,
justifyContent: "center",
display: 'flex',
alignItems: 'center',
}
const Button = () => <button style={buttonStyles}> Subscribe </button>
const App = () => (
<div className='app'>
<Header />
<Main />
<Button />
</div>
)
const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
I tried to use justifyContent: "center", display: 'flex', alignItems: 'center', but still without success.