DEV Community

Said Mounaim
Said Mounaim

Posted on

3 2

React Smooth Scroll Effect

React Provider Component to add a smooth scroll effect

Live demo: https://react-smooth-scroll-effect.netlify.app/

Install

npm install --save react-use-smooth-scroll
Enter fullscreen mode Exit fullscreen mode

Usage

import React from 'react'

import { UseEffectScroll } from 'react-use-smooth-scroll'
import 'react-use-smooth-scroll/dist/index.css'

const App = () => {
  return (
    <UseEffectScroll>
      <section className='bgGreen'>
        <h1>Section 1</h1>
      </section>
      <section className='bgOrange'>
        <h1>Section 2</h1>
      </section>
      <section className='bgBlue'>
        <h1>Section 3</h1>
      </section>
      <section className='bgGrey'>
        <h1>Section 4</h1>
      </section>
    </UseEffectScroll>
  )
}

export default App
Enter fullscreen mode Exit fullscreen mode

Follow Me On Github :
https://github.com/saidMounaim

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay