0

I am trying to implement a project like:

https://codepen.io/andytran/pen/GpyKLM

As you can see there is javascript that is needed for the page to function. I am trying to build a Next/React component that implements this code:

import React, { Component } from 'react';
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>




class Auth extends Component {

  render() {
    
    return (
      <div className="App">
        <Header></Header>
        <div className="container mrgnbtm">
          <div className="row">
            <div>
              hello
            </div>
          </div>
        </div>
      </div>
    );
  }
}

export default Auth;

Where would I put the javascript in the above example? Also, how would I call code from a scss file?

1 Answer 1

3

What you do is anti-pattern, instead of importing bootstrap from a CDN you can use reactstrap package.

for element listeners, must pass those to each element that you want, like onClick:

<div id="button" onClick={() => alert("button clicked!")} ....

and for using SCSS in your next app, first you have to install the sass package:

npm install sass --save

then reload the dev server and import SCSS file in component, e.g:

import styles from '../../styles/Home.module.scss'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.