File tree 3 files changed +17
-18
lines changed
3 files changed +17
-18
lines changed Original file line number Diff line number Diff line change 2
2
3
3
transforms a vue component in a react one
4
4
5
+ TODO: to be updated after latest modifications
6
+
5
7
## usage example
6
8
7
9
* export a vue component as a react builder:
Original file line number Diff line number Diff line change
1
+ declare module 'reactify-vue' ;
Original file line number Diff line number Diff line change 1
-
2
- // compute a unique hash for multiple reactified components
1
+ // TODO: compute a unique hash for multiple reactified components
3
2
const getId = component => {
4
- return ' vue-component-id'
5
- }
3
+ return " vue-component-id" ;
4
+ } ;
6
5
7
- export default ( _vueInstance , component ) => _reactInstance => {
8
- const id = getId ( component )
6
+ export default buildVueInstance => _reactInstance => {
7
+ const id = getId ( ) ;
9
8
10
- return class Wrapper extends _reactInstance . Component {
11
- render ( ) {
12
- return _reactInstance . createElement ( 'div' , { id } )
13
- }
14
- componentDidMount ( ) {
15
- new _vueInstance ( {
16
- el : `#${ id } ` ,
17
- components : { app : component } ,
18
- render : createElement => createElement ( 'app' , { props : this . props } )
19
- } )
20
- }
9
+ return class Wrapper extends _reactInstance . Component {
10
+ render ( ) {
11
+ return _reactInstance . createElement ( "div" , { id } ) ;
12
+ }
13
+ componentDidMount ( ) {
14
+ const vueApp = buildVueInstance ( this . props )
15
+ vueApp . $mount ( `#${ id } ` ) ;
21
16
}
22
- }
17
+ } ;
18
+ } ;
You can’t perform that action at this time.
0 commit comments