AnswerBun.com

How to import react libraries into pure jsx file

Stack Overflow Asked by DannyCranfield on August 17, 2020

I’m following this tutorial.

It uses JSX files to contain the relevant react code for each component of the system so Home, Index etc along with a corresponding HTML file.

I’m used to using pure React where I can import libraries by using the import keyword.

However in JSX it seems I have to declare the libraries differently by importing them into the HTML via script sources.

How would I go about importing this text editor library which is for ReactJS when it expects the typical import call.

I’ve tried following the current architecture from the tutorial by declaring it differently in the JSX file as var SunEditor = 'suneditor-react';

This does not work, I’ve had to instead import the pure Javascript version of the library which is the first one here. As by using the pure JS version I can simply import via script references in the corresponding HTML file that matches the given JSX file.
i.e. <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/suneditor.min.js"></script>

Add your own answers!

Related Questions

How to get records ordered by joined table field

2  Asked on December 16, 2021 by jaime

 

how to display input using button in right to left order?

5  Asked on December 16, 2021 by mr-josh

       

Kotlin Image Compression Implementation

1  Asked on December 16, 2021 by android

       

Finding a cover of a set of points with circles

2  Asked on December 16, 2021 by user577545

   

Pytorch: all-but-one summation?

3  Asked on December 16, 2021 by sterne

   

Is it okay to mark @Input() as private or readonly?

2  Asked on December 16, 2021 by natoboram

   

Linking URL in JavaScript

2  Asked on December 16, 2021 by vuk-stamenkovic

   

Making a 2×2 grid in Flutter

2  Asked on December 16, 2021 by zerok

   

Uniform tick labels for non-linear colorbar in Matplotlib

1  Asked on December 16, 2021 by marie-eve-lb

     

Custom Javadoc not showing in IDE

1  Asked on December 16, 2021 by hugo-bois

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir