@Component angular import module code example

Example 1: is declared by more than one NgModule.

You can't declare a component in more than 1 module.
If both modules need it, you need to declare/export your component in a third
module and imports this one in abc & def.

@NgModule({
  imports:      [ MainModule ]
})
export class AbcModule { }

@NgModule({
  imports:      [ MainModule ]
})
export class DefModule { }

@NgModule({
  declarations: [ CommonMod ],
  exports:    [ CommonMod ]
})
export class MainModule { }

Example 2: export component in

//Export single component in react.js
import React from "react";

function MyInfo() {
    return (
      <div>
        <h1>Swapnil</h1>
        <p>Hy this is Swapnil, I have no idea who I am</p>
        <ul>
          <li>Ladakh</li>
          <li>Himachal Pradesh</li>
          <li>Vellangiri Mountains</li>
        </ul>
      </div>
    )
  }

export default MyInfo