forked from oslabs-beta/sapling
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test 14: Folders as modules / batch exports / barrel files - export * from './File' import { File } from './dir' * test 15: - Variable declaration with.. a) object destructuring alias assignment b) array destructuring - Import Decaration with... * glob import and namespace specifier * See: Issue oslabs-beta#85, oslabs-beta#99
- Loading branch information
Showing
15 changed files
with
301 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Page1, Page2, Page3 } from './components'; | ||
|
||
export default function Routes() { | ||
return ( | ||
<div> | ||
<Page1 /> | ||
<Page2 /> | ||
<Page3 /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page1 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>This is Page 1</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
export default Page1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page2 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>I am Page2.</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
export default Page2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page3 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>I am Page3.</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
export default Page3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './Page1'; | ||
export * from './Page2'; | ||
export * from './Page3'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
|
||
import App from './App.jsx'; | ||
|
||
// TEST 15 - Barrel Files | ||
// index.js, index.ts files that contain "export * from './file'" statements. | ||
// and enable folders to be used as modules | ||
// e.g. import { file } from './dir' | ||
|
||
render( | ||
<div> | ||
<App /> | ||
</div>, | ||
document.getElementById('root') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const { Page1: Alias } = import('./Page1'); | ||
const [ Page1of2, Page2of2 ] = import('./Page2'); | ||
import * as namespace from './Wrapper'; | ||
import * as LastPage from './Page4'; | ||
import * as DefaultExport from './Page5'; | ||
|
||
export default function Routes() { | ||
return ( | ||
<div> | ||
<Alias /> | ||
<Page1of2 /> | ||
<Page2of2 /> | ||
<namespace.Page3_1 /> | ||
<namespace.Page3_2 /> | ||
<LastPage.Page4_1 /> | ||
<LastPage.Page4_2 /> | ||
<DefaultExport /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page1 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>This is Page 1</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
export default Page1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page1of2 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>I am Page1of2.</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
class Page2of2 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>I am Page2of2.</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
export default [ Page1of2, Page2of2 ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Page3_1 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>I am Page3_1.</div> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
class Page3_2 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>I am Page3_2.</div> | ||
</section> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export class Page4_1 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>This is Page 4_1</div> | ||
</section> | ||
) | ||
} | ||
}; | ||
|
||
export class Page4_2 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>This is Page 4_2</div> | ||
</section> | ||
) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export default class Page5 extends Component { | ||
render () { | ||
return ( | ||
<section> | ||
<div>This is Page5</div> | ||
</section> | ||
) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Page3'; |
Oops, something went wrong.