Skip to content

Comments

feature/Radio group#117

Open
ancientbag wants to merge 14 commits intomasterfrom
feature/radio-group
Open

feature/Radio group#117
ancientbag wants to merge 14 commits intomasterfrom
feature/radio-group

Conversation

@ancientbag
Copy link
Contributor

No description provided.

const Radio = ({ value, children }: IRadioProps): JSX.Element => {
const { name, value: groupValue, setValue } = useRadioGroupContext();

const radioId = useMemo(() => `${name}-${value}`, [name, value]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем тут useMemo и useCallback чуть ниже?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно убрать да. Я тут эксперимертировал с ререндером


return {
name,
value: _value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не понял смысл нижнего подчеркивания у _value, почему нельзя просто value назвать и его отдать?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Раньше value пропс был. Это рудимент. Уберу

(targetValue: string) => {
setValue(targetValue);

if (onChange) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно сократить до onChange?.(targetValue);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно

@ancientbag
Copy link
Contributor Author

Надо дописать тесты

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants