Framework versus Library
Library describes an external collection of functions that perform a given task. These functions are made accessible to us as users of the library via APIs. One useful library is lodash
, which can, for example, remove all duplicated values from an array:
const duplicatedArray = [1,2,1,2,3]; const uniqueArray = lodash.uniq(duplicatedArray) // => [1,2,3]
Frameworks, on the other hand, are a particular form of library. They are reusable code frames that build the foundation of a JavaScript application. In contrast to libraries, which extend your code with functionality, a framework can stand alone and is enhanced with your source code to create an app as you like.
A popular framework is Vue.js
, which we can use as follows:
library-vue.js
1Â // example.html 2Â <div id="example"> 3Â <input :value="text" @input="update"/> 4Â <div v-html="myOwnText"></div> 5Â <...