FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Easy

Temperature Converter

15 mins

Build a React widget that converts temperature values between Celsius and Fahrenheit.

Requirements:

  1. Render two number inputs: one for Celsius and one for Fahrenheit.
  2. Updating one input should automatically update the other.
  3. Use the conversion formulas:
    • Celsius to Fahrenheit: (C × 9/5) + 32
    • Fahrenheit to Celsius: (F − 32) × 5/9
  4. Prevent infinite loops when updating both fields.
  5. Focus on functionality over styling.
  6. The component should work out-of-the-box in a live React preview (e.g., CodeSandbox/Sandpack).

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component