8

am trying to integrate https://react-table.js.org/#/story/readme in vue.js app using https://github.com/akxcv/vuera.

My main.js:

import Vue from 'vue'
import { VuePlugin } from 'vuera'
import App from './App'
import router from './router'


Vue.config.productionTip = false

Vue.use(VuePlugin)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App },
})

My HelloWorld.vue:

<template>
  <div class="hello">
    <h1>{{ msg }}</h1>

    <ReactTable :data="data" :columns="columns" />

  </div>
</template>

<script>
import ReactTable from 'react-table'
import 'react-table/react-table.css'

export default {
  name: 'HelloWorld',
  components: { ReactTable },
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
      columns: [{ Header: 'Name', accessor: 'name' }],
      data: [ {name: 'tom'}]
    }
  }
}
</script>

Upon running this code I get two errors in console:

[Vue warn]: Error in mounted hook: "TypeError: children is not a function"

found in

---> <ReactWrapper>
       <ReactTable>
         <HelloWorld> at src/components/HelloWorld.vue
           <App> at src/App.vue
             <Root>

and:

vue.esm.js?efeb:1717 TypeError: children is not a function
    at ReactTable.render (index.js?5f89:822)
    at eval (ReactCompositeComponent.js?063f:793)
    at measureLifeCyclePerf (ReactCompositeComponent.js?063f:73)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js?063f:792)
    at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js?063f:819)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js?063f:359)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js?063f:255)
    at Object.mountComponent (ReactReconciler.js?c56c:43)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js?063f:368)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js?063f:255)

Is it something wrong I'm coding or vuera plugin just doesn't handle ReactTable component integration correctly?

Many thanks for any ideas!

1
  • 1
    Possible to get a minimal git repo? Else setting up the environment eats up some time Commented Apr 4, 2018 at 10:37

1 Answer 1

3
+25

So I recreated the project and it worked fine for me, below are set of dependencies I used. I think your case it might be just version mismatch issue

  "dependencies": {
    "react": "^16.3.1",
    "react-dom": "^16.3.1",
    "react-table": "^6.8.0",
    "vue": "^2.5.2",
    "vue-router": "^3.0.1",
    "vuera": "^0.2.1"
  }

Please make sure you try with above version. The output is

Working

The project is available on below link if you want to just clone and test

https://github.com/tarunlalwani/react-vue-integration

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry for delay approval of answer. Managed to clone your repo and get it working! Thanks a lot for your effort, much appreaciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.