Challenge - 5 Problems
React-Bootstrap Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediateWhat will this React-Bootstrap Button render?
Consider this React component using react-bootstrap:
What will you see in the browser?
import Button from 'react-bootstrap/Button';
function MyButton() {
return <Button variant="success" size="lg">Click Me</Button>;
}What will you see in the browser?
Bootsrap
import Button from 'react-bootstrap/Button'; function MyButton() { return <Button variant="success" size="lg">Click Me</Button>; }
Attempts:
2 left
💡 Hint
Look at the variant and size props used in the Button component.
✗ Incorrect
The 'variant="success"' applies green color styling, and 'size="lg"' makes the button large.
❓ selector
intermediateWhich CSS class does react-bootstrap add for a primary Button?
When you use <Button variant="primary"> in react-bootstrap, which CSS class is added to the button element?
Attempts:
2 left
💡 Hint
Bootstrap buttons always have a base 'btn' class plus a variant class.
✗ Incorrect
React-bootstrap adds 'btn' as the base class and 'btn-primary' for the primary variant, matching Bootstrap's CSS.
🧠 Conceptual
advancedWhy use react-bootstrap instead of plain Bootstrap CSS in React?
Which of these is the main advantage of using react-bootstrap components over just adding Bootstrap CSS classes in React?
Attempts:
2 left
💡 Hint
Think about how React components help with interactivity and accessibility.
✗ Incorrect
React-bootstrap offers React components that handle Bootstrap styles plus JavaScript behavior and accessibility features, making development easier and more consistent.
❓ layout
advancedHow does react-bootstrap's Grid system help with responsive layouts?
Given this react-bootstrap code:
How will the columns behave on small and medium screens?
import { Container, Row, Col } from 'react-bootstrap';
function Layout() {
return (
<Container>
<Row>
<Col xs={12} md={6}>Left</Col>
<Col xs={12} md={6}>Right</Col>
</Row>
</Container>
);
}How will the columns behave on small and medium screens?
Bootsrap
import { Container, Row, Col } from 'react-bootstrap'; function Layout() { return ( <Container> <Row> <Col xs={12} md={6}>Left</Col> <Col xs={12} md={6}>Right</Col> </Row> </Container> ); }
Attempts:
2 left
💡 Hint
Look at the xs and md props on the Col components.
✗ Incorrect
The xs={12} means full width on extra small screens, stacking vertically. The md={6} means half width on medium and larger screens, placing columns side by side.
❓ accessibility
expertWhich react-bootstrap component helps improve accessibility for screen readers in modals?
When using react-bootstrap's Modal component, which prop or feature is essential to ensure screen readers can identify the modal dialog properly?
Attempts:
2 left
💡 Hint
Screen readers need a label to announce what the modal is about.
✗ Incorrect
The 'aria-labelledby' attribute links the modal dialog to its title, so screen readers announce the modal's purpose clearly.
