score:0

I don't think you can import js code on a react app, probably you have to create react-app first, then create its components and add you javascript code within these components, it´s pretty easy, i recomment you to read the documentation of react and see how it works. Hope it helped you.

score:0

You can include JavaScript functions inside JSX itself :

import React from 'react';

const Something=()=>{

  //  Your javascript functions :

  return(
    <div>
      Your Html here
    </div>
  )
}

export default Something

//  Or if You are using Class Component :

import React, { Component } from 'react';

class Something extends Component {
  state = {  }

  // Your Javascript Functions
  
  render() { 
    return ( 
      <div>
        Your HTML goes here 
      </div>
     );
  }
}
 
export default Something;

and if you want to import js file from another location you have to include export in your function:

export const Name=()=> {
             
}

and import:

import {Name} from '/location';


Related Query

More Query from same tag