loadable-components icon indicating copy to clipboard operation
loadable-components copied to clipboard

how to pass props to lodables.lib()

Open smsivaprakaash opened this issue 6 years ago • 3 comments

💬 Questions and Help

Trying to load react-dropdown lib via lodable.lib(). it is not loading the component

Using Ordinary import:

   import Drop form 'react-dropdown';
   const dropOptions = ['one', 'two', 'three'];`
   ....
   render() {
       return (<Drop options={dropOptions/>)
   }}

Using lodable.lib():

    const Drop= loadable.lib(() => import('react-dropdown'));
    const dropOptions = ['one', 'two', 'three'];`
    ....
   render() {
       return (<Drop options={dropOptions/>)
   }}

It was working with ordinary import, but now with loadabl.lib

Can you help if any syntax is wrong or any extra steps is needed to load the 3rd party libs in loadable. Thanks,

smsivaprakaash avatar Oct 22 '20 07:10 smsivaprakaash

Hey @smsivaprakaash :wave:, Thank you for opening an issue. We'll get back to you as soon as we can. Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers. If you use Loadable at work, you can also ask your company to sponsor us :heart:.

open-collective-bot avatar Oct 22 '20 07:10 open-collective-bot

was able to find out the syntax for it. without using lib()

const Drop= loadable(() => import('react-dropdown));

smsivaprakaash avatar Oct 22 '20 07:10 smsivaprakaash

yep. Everything what is Components is not a lib

theKashey avatar Oct 22 '20 07:10 theKashey