It is an ecological component of habitat which is delimited by functioning of an organism. A niche does not have components.Niche supports a single species. Niche has a specific set of environmental regimes. A species may live in more than one niche in different stages of its life cycle.For example, a garden spider is a predator that hunts for prey among plants, while an oak tree grows to dominate a forest canopy, turning sunlight into food. The role that a species plays is called its ecological niche.
Habitat:It is a specific place or locality where a community resides. A habitat has a number of niches.Habitat supports a number of species. A number of environmental variables occur in a habitat. A species does not change its habitat.Deserts, oceans, forest, rivers, mountains, etc. are examples of habitat.