0
0
Remixframework~20 mins

CSS Modules in Remix - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CSS Modules Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
How does CSS Modules scope styles in Remix?

Consider a Remix component importing a CSS Module file. What happens to the CSS class names when the component is rendered?

Remix
import styles from './Button.module.css';

export default function Button() {
  return <button className={styles.primary}>Click me</button>;
}
AThe class name 'primary' is replaced with a unique generated name scoped to this component.
BThe class name 'primary' is used as-is globally across the app.
CThe CSS is ignored and no styles are applied to the button.
DThe class name 'primary' is converted to inline styles automatically.
Attempts:
2 left
💡 Hint

Think about how CSS Modules prevent style conflicts by changing class names.

📝 Syntax
intermediate
1:30remaining
Which import statement correctly imports a CSS Module in Remix?

Given a CSS Module file named styles.module.css, which import statement is valid in a Remix component?

Aimport styles from './styles.module.css';
Bimport './styles.module.css';
Cimport * as styles from './styles.module.css';
Dimport styles from './styles.css';
Attempts:
2 left
💡 Hint

CSS Modules require importing the styles as an object to access class names.

🔧 Debug
advanced
2:30remaining
Why does this CSS Module style not apply in Remix?

Look at the code below. The button does not get styled as expected. What is the most likely cause?

Remix
import styles from './Button.module.css';

export default function Button() {
  return <button className="styles.primary">Click me</button>;
}
AThe CSS Module file is missing from the project directory.
BThe className is a string literal and does not reference the imported styles object.
CRemix does not support CSS Modules for button elements.
DThe styles.primary class is not defined in the CSS Module file.
Attempts:
2 left
💡 Hint

Check how the className is assigned in JSX when using CSS Modules.

state_output
advanced
2:00remaining
What is the rendered class attribute value for this Remix component using CSS Modules?

Given the CSS Module Card.module.css with a class container, and this component:

import styles from './Card.module.css';

export default function Card() {
  return <div className={styles.container}>Content</div>;
}

What will the class attribute look like in the browser?

A"undefined" (no class applied)
B"container" (the original class name as-is)
C"container_abc123" (a unique generated name with a hash suffix)
D"styles_container" (the imported object name prefixed)
Attempts:
2 left
💡 Hint

CSS Modules add unique hashes to class names to scope styles.

🧠 Conceptual
expert
3:00remaining
Why are CSS Modules preferred over global CSS in Remix for large projects?

Choose the best explanation for why CSS Modules are often used instead of global CSS files in Remix applications.

ACSS Modules automatically convert CSS to inline styles, improving performance.
BGlobal CSS files are not supported in Remix, so CSS Modules are the only option.
CCSS Modules allow writing CSS in JavaScript syntax, which global CSS does not.
DCSS Modules scope styles locally, preventing unintended style overrides and making maintenance easier.
Attempts:
2 left
💡 Hint

Think about how style conflicts happen in big projects and how CSS Modules help.