new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

React · API reference · all subjects

react-dom/styling

3 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

className for CSS classes in React

In React, you specify a CSS class with the className attribute, which works like the class attribute in HTML. Example: <img className="avatar" />. React does not prescribe how you add CSS files; in the simplest case, add a <link> tag to your HTML.

style attribute for dynamic styles

Use the style attribute to pass CSS styles dynamically based on JavaScript variables. The style prop takes a JavaScript object with camelCase properties. Example: style={{ width: user.imageSize, height: user.imageSize }}. The syntax style={{}} is a regular object inside JSX curly braces.

Conditional CSS classes with className

To apply CSS classes conditionally, produce the className string using JavaScript. Example: className={'row ' + (isSelected ? 'selected': '')} produces either "row" or "row selected" depending on the condition. The classnames library can make this more readable: className={cn('row', isSelected && 'selected')} or className={cn('row', { selected: isSelected, large: size === 'large' })}.

Give your agent this brain