0

I am trying to use react-loadable on third party react components. It is just showing blank page. When I used it to code split my own components, it worked fine.

import React from 'react'
import Loadable from 'react-loadable'; 

const Loading = () => <div>Loading...</div>
const Modal = Loadable({
    loader: () => import('react-responsive-modal'), 
    /*loader: () => import('./My-Own-Component'),//this works fine.*/
    loading: Loading
});

class MyTest extends React.Component{

    render(){
       return(<Modal />)
    }
}
export default MyTest

I am sure the way I am using is wrong. Please advise. Thanks.

texan2018
  • 21
  • 4

1 Answers1

0

Just a hunch. Can you try extracting the component inside react-responsive-modal into a custom component and try to see if that works.

I think React loadable is not able to import 3rd party components directly.

  • I just tried above code as it is with a third party component and it works. But it doesn't work for another component. I will try to do like you said. Thanks so much. – texan2018 Oct 13 '18 at 19:20