web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Import Web Resource (html/react) with multiple scripts files (WITHOUT NODE.JS)

(0) ShareShare
ReportReport
Posted on by 110

FIRST, I need to know how to import a Web Resoruce (html with react.js) WITHOUT USING NODE.JS! then... I want to create a solution with a Web Resource (an html file with react.js) with multiple scripts linked to it, I have no Idea how to do it, ¿can someone give me a simple example? I CAN'T USE NODE.JS or any other thing, just the html with react, and I need to put the scripts files in it.

This is my code (doesn't work): 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="icon" type="image/png" href="src/reactFavicon.png">
    <link href="">fonts.googleapis.com/css rel="stylesheet">
    <title>Users</title>
    <script type="application/javascript" src="">unpkg.com/.../react.production.min.js"></script>
    <script type="application/javascript" src="">unpkg.com/.../react-dom.production.min.js"></script>
    <script type="application/javascript" src="">unpkg.com/.../babel.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/javascript" src="users.js">
</body>
</html>
--------------------------------------------------------------------------------------------------------------------
This is the users.js script:
        const rootElement = document.getElementById('root')

        class Users extends React.Component {
            constructor(props) {
                super(props)
                this.state = {
                    items:[],
                    isLoaded: false
                }
            }

            componentDidMount() {
                fetch('jsonplaceholder.typicode.com/users')
                .then(res => res.json())
                .then(json => {
                    this.setState({
                    isLoaded: true,
                    items: json
                })
                })
            }

            render() {
                const title = this.props.title;
                var {isLoadeditems} = this.state;
                if(!isLoaded) {
                    return <div>Loading...</div>
                } else {
                    return(
                        <div class="Users">
                            {title}
                            <ul>
                                {items.map(item => (
                                    <li key={item.id}>
                                        {item.name} | {item.email} ||| lives in {item.address.street}{item.address.suite} ({item.address.city}), his/her phone number is {item.phone} and works in <strong>{item.company.name}</strong>.
                                    </li>
                                )) }
                            </ul>
                        </div>
                    )
                }
            }
        }
 
        function App() {
            return (
                <div>
                <Users 
                    title = "Users"
                />
                </div>
            )
        }

        ReactDOM.render(
            <App />,
            rootElement
        )
--------------------------------------------------------------------------------------------------------------------
If someone can really help me with this, I'll be really thankful (the code is just an example, it can be any other thing you want, just keep it simple). 
I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I haven't done that myself but some of my colleagues use gulp for that purpose - www.davepaquette.com/.../how-to-use-gulp-in-visual-studio.aspx

  • cloflyMao Profile Picture
    25,210 on at

    Hi Partner,

    It seems that your example is modified based on the following link?

    https://dev.to/luispa/lets-try-react-without-nodejs-3a7

    I'm not known about React, but I could run the example inside the link:

    1. Because Babel.js is used to compile React snippet, so we should also change script tag to:

     pastedimage1577346920181v1.png

    2. By doing this my web resource could run React code.

    (I opened it with openWebResource)

    var windowOptions = { height: 400, width: 400 }
    Xrm.Navigation.openWebResource("new_react_example",windowOptions);

    HTML:

    pastedimage1577347035221v2.png

    HTML code:

    
      
      
      
      React Local
      
      
      
    
    
    
      

    js in React style:

    pastedimage1577347067368v3.png

    js code:

    // Obtain the root 
    const rootElement = document.getElementById('root')
    // Create a ES6 class component    
    class ShoppingList extends React.Component {
        // Use the render function to return JSX component      
        render() {
            return (
                

    Module List for {this.props.name}

    • Sales
    • Customer Service
    • Marketing
    ); } } // Create a function to wrap up your component function App() { return (
    ) } // Use the ReactDOM.render to show your component on the browser ReactDOM.render( , rootElement )

    result:

    pastedimage1577347114688v4.png

    So please change the script tag attribute and refered js link to test again.

    Regards,

    Clofly

  • Tiffastic Profile Picture
    Microsoft Employee on at

    Thank you so much Clofly, I needed to add React code to our Dynamics app and I was scouring the web to do so.  Your post gave me guidance on how to accomplish this.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 215 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
Zhilan Profile Picture

Zhilan 61

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans