Learn Before
Concept

Why does React Js care about purity?

  • Components can run in different environments, for example, on a server, as long as they return the same result from the same inputs.
  • You can improve performance by skipping rendering; this is safe since the component always returns the same results from the same inputs.
  • If some data changes in the middle of rendering, React can stop the calculation and recalculate again. Purity makes it safe to stop the calculation at any time.

0

1

Updated 2023-04-19

Tags

JavaScript Programming Language

Object-Oriented Programming

Programming Language Paradigms

General programming languages

Computing Sciences