bem / bem/bem-react

@bem-react/core: Recreated component after modifier changed

Open
#589 1 comment 0 reactions 0 assignees View on GitHub
bug scope: core
Dominant language
TypeScript
Stars
450
Forks
69
PR merge metrics
No merged PRs in 30d

Description

## Info

If we have complex modifier, and we enabled this dynamically then component will be created again, and focus will be removed from component.

### Example

**modifier:**

```ts
export const withClear = withBemMod('Component', { clearable: true }, (Component) => {
return function WithClear() {
return X} />
}
})
```

**usage:**

```ts
function App() {
const [clearable, setClearable] = React.useState(false)

React.useEffect(() => {
setTimeout(() => setClearable(true), 1000)
}, [])

return (

)
}
```

### Expected behavior

Component should update without focus side-effects.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.