This is the way to go:
 

    "autoload": {
        "files": [ "registration.php" ],
        "psr-4": {
          "Amit\\SamplePage\\": ""
        }
      }


The map function in Composer:

       "extra": {
            "map": [
                [
                    "*",
                    "Amit/SamplePage"
                ]
            ]
        }


forces the extension to be installed in `app/code`. This was used in older beta's of Magento 2. Although this will work, it's not the way Magento loads extensions anymore. If you do not use the map function the extension will be installed in the vendor folder, as it should be.

`registration.php` defines the type: theme or extension and registers your theme/extension in Magento 2.

The `composer.json` file is added so the extension can be loaded via Composer. It also handles the autoloading for your extension.