I've set up my new laravel project with react UI using php artisan ui react. Did the npm install and npm run dev. Added the react id and script link to the welcome.blade.php. now the example react component is loading but bootstrap styling isn't present at that page. my codes are below,
app.js:
require('./bootstrap');
require('./components/Example');
Example.js:
import React from 'react';
import ReactDOM from 'react-dom';
function Example() {
return (
<div className="container">
<div className="row justify-content-center">
<div className="col-md-8">
<div className="card">
<div className="card-header">Example Component</div>
<div className="card-body">I'm an example component!</div>
</div>
</div>
</div>
</div>
);
}
export default Example;
if (document.getElementById('example')) {
ReactDOM.render(<Example />, document.getElementById('example'));
}
I'm using laravel 8.12. Am I missing something?
import './<pathToStyle>/bootstrap.css';. and don't forget that bootstrap needs jquery for many components to function properly, thought I doubt the card does ... and it would be in example.js@import '~bootstrap/scss/bootstrap';i changed it to@import "../../node_modules/bootstrap/scss/bootstrap";and imported it to my example.js.