A factory is an object that creates and returns other objects. It is often used to hide complex implementation details. For example returning a new database connection and taking care of the parameters behind the scenes. With NodeJS a factory can also help deal with cache issues when declaring several instances of a module.
I wrote a bunch of shell scripts to create a React component project. Then I decided to turn those scripts into a Yeoman generator. There are other component project generators out there. But I wanted something I could own and customize.