File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,19 @@ import * as northwind from './northwind.js';
77
88
99let el = document . querySelector ( '#app' ) ,
10+ tags = { } ,
1011 templates = { } ,
1112 data = { northwind} ,
1213 lookup = { } ,
1314 links = [ ] ,
1415 key = 1 ;
1516
1617
18+ Object . keys ( components ) . forEach ( name => {
19+ tags [ 'ax-' + name . toLowerCase ( ) ] = components [ name ] ;
20+ } ) ;
21+
22+
1723function path ( s ) {
1824 return '/' + s . replace ( / ^ \W + | \W + $ / g, '' ) . replace ( / \W + / g, '-' ) . toLowerCase ( ) ;
1925}
@@ -35,9 +41,9 @@ function index(name){
3541}
3642
3743
38- function render ( Component , props ) {
44+ function render ( component , props ) {
3945 props . key = ++ key ;
40- ReactDOM . render ( React . createElement ( Component , props ) , el ) ;
46+ ReactDOM . render ( React . createElement ( tags [ component ] , props ) , el ) ;
4147}
4248
4349
@@ -47,7 +53,7 @@ function refresh(){
4753 mode = RegExp . $1 ;
4854
4955 if ( name && typeof lookup [ name ] == 'function' ) {
50- lookup [ name ] ( { render} , components , templates , data ) ;
56+ lookup [ name ] ( { render} , templates , data ) ;
5157 }
5258 else {
5359 index ( name ) ;
You can’t perform that action at this time.
0 commit comments