New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-string-diff

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-string-diff

custom react hook to get the difference between two strings

  • 1.4.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

use-string-diff

custom react hook to get the difference between two strings

Build Status Version Downloads

  • Installation
  • Usage
  • Issues
  • LICENSE

Installation

This module is distributed via NPM which is bundled with NodeJS and should be installed as one of your project's dependencies:

npm install use-string-diff --save or yarn add use-string-diff

Usage

Single Value

import { useStringDiff } from 'use-string-diff'


const MyComponent = () => {
  const [state, setState] = useState('');

  const difference = useStringDiff(value);

  return (
    <div>
      <input
        onChange={(event) => {
                setState(event.target.value);
            }}
        value={value}
        />
    </div>
  )
}

Two Values

import { useStringDiff } from 'use-string-diff'

const INITIAL_STRING = 'Initial String';
const MyComponent = () => {

  const [state, setState] = useState(INITIAL_STRING);

  const difference = useStringDiff(INITIAL_STRING, state);

  return (
    <div>
      <input
        onChange={(event) => {
                setState(event.target.value);
            }}
      value={value}/>
    </div>
  )
}

🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

LICENSE

MIT

Keywords

FAQs

Package last updated on 21 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc