Skip to content

Commit

Permalink
Merge pull request #522 from wwahammy/embed-use-previous
Browse files Browse the repository at this point in the history
Embed usePrevious so we don't need to pack our output
  • Loading branch information
wwahammy authored Jan 2, 2025
2 parents 90cb587 + f7498be commit f78f26b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 257 deletions.
4 changes: 4 additions & 0 deletions included.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{
"name": "react-currency-input",
"version": "1.3.6"
},
{
"name": "react-use",
"version": "15.3.0"
}
]
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"react-is-16": "npm:react-is@^16",
"react-is-17": "npm:react-is@^17",
"react-is-18": "npm:react-is@^18",
"react-use": ">=15.3.0",
"rimraf": "^6.0.1",
"storybook": "^8.1.10",
"terser-webpack-plugin": "^5.3.3",
Expand Down
2 changes: 1 addition & 1 deletion src/useI18nCurrencyInput.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later
// from: https://github.com/jsillitoe/react-currency-input/blob/master/src/index.js
import React, { useState, useRef, useCallback, useEffect } from 'react';
import usePrevious from 'react-use/lib/usePrevious';
import usePrevious from './usePrevious';
import { MoneyFormatHelper} from './money_format_helper';
import { UseI18nCurrencyInputProps, MaskedAndRawValues, UseI18nCurrencyInputResult } from './types';

Expand Down
14 changes: 14 additions & 0 deletions src/usePrevious.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//* from https://github.com/streamich/react-use/blob/ad33f76dfff7ddb041a9ef74b80656a94affaa80/src/usePrevious.ts */
/** we put this in here so we don't have reference react-use and deal with linking that in */

import { useEffect, useRef } from 'react';

export default function usePrevious<T>(state: T): T | undefined {
const ref = useRef<T>();

useEffect(() => {
ref.current = state;
});

return ref.current;
}
Loading

0 comments on commit f78f26b

Please sign in to comment.