is a programming paradigm — a style of building the structure and elements of computer programs — that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
To know if a function is pure or not according to the following:
- t returns the same result if given the same arguments.
- It does not cause any observable side effects.
- The code’s definitely easier to test. We don’t need to mock anything.
- Pure functions are stable, consistent, and predictable. Given the same parameters, pure functions will always return the same result.
When data is immutable, its state cannot change after it’s created. If you want to change an immutable object, you can’t. Instead, you create a new object with the new value.
it assures you the purest function will always have the same output, given the same input.Basically, if a function consistently yields the same result for the same input, it is referentially transparent.
it is another javascript file that is used to organize our work rather than putting all in a single file that is the App.js because if we keep it in the App.js it will become very messy.
is a built-in function to include external modules that exist in separate files. require() statement basically reads a JavaScript file, executes it, and then proceeds to return the export object.
we use export by the syntax: module.export = the name of the class.