The 「の」 particle in this usage essentially replaces the noun and takes over the role as a noun itself. We can essentially treat adjectives and verbs just like nouns by adding the 「の」 particle to it. The particle then becomes a generic noun, which we can treat just like a regular noun.