Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

fix: remove react from distributed bundle #104

Merged
merged 3 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"classnames": "^2.3.1",
"lodash": "^4.17.21"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
},
"devDependencies": {
"@babel/cli": "7.14.3",
"@babel/core": "^7.14.3",
Expand Down
15 changes: 3 additions & 12 deletions src/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import React, {
useCallback,
useEffect,
useState,
useRef,
useMemo,
} from 'react';
import React, { useCallback, useEffect, useState, useRef } from 'react';
import classNames from 'classnames';
import get from 'lodash/get';

Expand Down Expand Up @@ -42,11 +36,8 @@ export const Dropdown: React.FC<ReactDropdownProps> = ({
clearIcon,
isClearable,
}) => {
const options = useMemo(
() => prepareOptions(originalOptions),
[originalOptions],
);
const [selected, setSelected] = useState(
const options = prepareOptions(originalOptions);
const [selected, setSelected] = useState(() =>
findSelected(options, value, matcher),
);
const [isOpen, setIsOpen] = useState(false);
Expand Down
9 changes: 3 additions & 6 deletions src/Selection.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useMemo } from 'react';
import React, { useState } from 'react';
import classNames from 'classnames';
import get from 'lodash/get';

Expand All @@ -19,11 +19,8 @@ export const Selection: React.FC<SelectionProps> = ({
noOptionsDisplay,
menu: MenuContainer,
}) => {
const options = useMemo(
() => prepareOptions(originalOptions),
[originalOptions],
);
const [selected, setSelected] = useState(
const options = prepareOptions(originalOptions);
const [selected, setSelected] = useState(() =>
findSelected(options, value, matcher),
);

Expand Down