# react-scroll-id

> This package is a used to scroll up and down to the exact component in the application 

[![NPM](https://img.shields.io/npm/v/react-scroll-to.svg)](https://www.npmjs.com/package/react-scroll-to) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-scroll-id
```

## Usage
Function Component
```jsx
import React from 'react'
import SectionScrollable ,{ScrollTo} from 'react-scroll-id'
const App = () =>{
  return (
    <SectionScrollable>
      <button onClick={()=>{ScrollTo({targetId:'exampleId',behavior:'auto'})}}>Click Me</button>
      <div id={'exampleId'}></div>
    </SectionScrollable>
  )
}

```

Class Component 
```jsx
import React, { Component } from 'react'
import SectionScrollable ,{ScrollTo} from 'react-scroll-id'
class Example extends Component {
  render() {
     return (
    <SectionScrollable>
      <button onClick={()=>{ScrollTo({targetId:'exampleId'})}}>Move to Container 1</button>
      <button onClick={()=>{ScrollTo({targetId:'containerId'})}}>Move Away</button>
      <div id={'exampleId'}>Container 1</div>
       <div id={'containerId'}>Away from the container</div>
    </SectionScrollable>
  )
  }
}
```

## License

MIT © [Yaswanth L](https://github.com/Yaswanth L)
