Results 1 to 4 of 4

Thread: Using an external library with a dependency on React

  1. #1
    Sencha User j.ashworth's Avatar
    Join Date
    Oct 2014
    Posts
    17
    Vote Rating
    6
      0  

    Default Using an external library with a dependency on React

    I want to include in my fiddle an external library (Recompose) that has a dependency on React.

    Is there a better way to do that than by including the React bundles ahead of time?

    (see the comment in the index.html)

    thanks

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,985
    Answers
    3974
    Vote Rating
    1334
      0  

    Default

    Fiddle isn't meant to be a full application development tool so certain things won't work as you'd like. For example, the code in index.html will get inserted within the generated <body> so it's not a full index.html. For react, what I do with the reactor stuff is I load react and babel from CDN and provide my own require function. For a short cut, if you wanted react you could check the reactor package (so long as you are using 6.5 modern it should be there) and that will allow you to use react.

    For any other external libraries, it needs to be hosted somewhere that you can load it from. If you want the asset to be loaded in the <head>, index.html won't work for you. Instead, you can right-click on the Assets node in the file tree and select the remote javascript option. This will ask for a url to load and it will be loaded in the <head> before the framework assets I believe.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User j.ashworth's Avatar
    Join Date
    Oct 2014
    Posts
    17
    Vote Rating
    6
      0  

    Default

    Thanks for the reply.

    My fiddle is an ExtReact demo so already has the reactor package checked.

    The problem is that, if you take the two React <script>s out of index.html, then React is not defined at the point Recompose is loaded.

    I tried including Recompose using the remote JavaScript option under Assets, and I tried putting it in index.html but neither worked unless I first included React ahead of Recompose in index.html. But since reactor already requires React, I was hoping I wouldn't have to do the same thing separately.

    I do appreciate that Sencha Fiddle isn't intended to be a full application development tool but for anyone evaluating or learning to use ExtReact, it's very useful to be able to try things out very quickly with libraries like RxJS, Redux and Recompose without having to download or npm install anything. (This can make all the difference in some industry sectors.)

    thanks

  4. #4
    Sencha User
    Join Date
    Sep 2017
    Posts
    1
    Vote Rating
    0
      0  

    Default

    It doesn't include full web application.

Similar Threads

  1. Replies: 3
    Last Post: 8 Jun 2017, 12:47 PM
  2. External library files
    By faireu in forum Sencha Cmd
    Replies: 1
    Last Post: 16 Dec 2016, 5:14 AM
  3. External library files
    By faireu in forum Sencha Architect 4.x: Q&A
    Replies: 1
    Last Post: 16 Dec 2016, 5:14 AM
  4. How to load an external library from the app.json?
    By lisdey89 in forum Ext 6: Q&A
    Replies: 2
    Last Post: 29 Feb 2016, 6:33 AM
  5. Importing external library into exttop
    By Luixo in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 15 May 2013, 4:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •