I am starting out on React and am just trying to style a button. It is ignoring the styling though. I am not sure if I am missing a package or if I am doing something rather simple incorrectly.
My App.js file
import React from 'react';
import Transactions from './Components/Transactions';
const App = props => {
return (
<div><Transactions /></div>
);
}
export default App;
My Transactions.js file
import React from 'react';
import Button from '../button/button';
const Transactions = (props) => {
return (
<Button caption='blah'></Button>
);
};
export default Transactions;
My button.js file
import React from 'react';
import classes from './button.css';
const button = (props) => (
<button
className={classes.Button}>{props.caption}
</button>
);
export default button;
My button.css file (both button.js and button.css are in a button folder under src)
.Button {
font-size: 24pt;
background-color: purple;
color: white;
width: 150px;
border-radius: 8px;
}
Edit 1 While I can get this to work by doing just the following modifications in the button.js file, I seek to do the CSS modules approach. I used create-react-app to create the application but think I must be missing something else. Do I need to eject the application? Am I missing an import library?
import React from 'react';
import './button.css';
const button = (props) => (
<button
className={"Button"}>{props.caption}
</button>
);
export default button;