Q 01/05

Why does JSX make React developers write className rather than HTML's class attribute?

A) It is reserved in JavaScript

B) It is a CSS-only term

C) It is a global function

D) It is a DOM event name

Answer · why

A) It is reserved in JavaScript

It is reserved in JavaScript, so React names the prop after the DOM property className instead; the same clash turns the label attribute for into html...

Q 02/05

Which pencil-and-paper game does the official React tutorial build, finishing with a 'time travel' move history?

A) Hangman

B) Tic-tac-toe

C) Battleship

D) Dots and Boxes

Answer · why

B) Tic-tac-toe

Tic-tac-toe is the tutorial's project, and its final step stores every board in a history array so a player can jump back to any earlier move.

Q 03/05

What does React's Strict Mode do to each component function in development to flush out impure code?

A) Runs it in a worker

B) Delays its output

C) Calls it twice

D) Logs every call

Answer · why

C) Calls it twice

Strict Mode calls it twice and discards one result, so a component whose output differs between the two runs is caught in development, where productio...

Q 04/05

Which deliberately alarming prop name does React require for injecting a raw HTML string into an element?

A) unsafelyInjectHTML

B) trustedInnerHTML

C) setRawInnerHTML

D) dangerouslySetInnerHTML

Answer · why

D) dangerouslySetInnerHTML

dangerouslySetInnerHTML takes an object shaped { __html: '...' } rather than a plain string, a second speed bump on top of the scary name before marku...

Q 05/05

Which four-word motto did Facebook give React Native in 2015, pointedly rejecting Java's cross-platform promise?

A) Learn once, write anywhere

B) Code once, ship everywhere

C) Build once, run natively

D) One codebase, every screen

Answer · why

A) Learn once, write anywhere

Learn once, write anywhere was the pitch: the launch post said Facebook was not chasing "write once, run anywhere", because each platform deserves its...

Want the full quiz?

Play the full React JS Trivia quiz — scored, streaked, and passable to a friend.

Play it on BrainPickle