Skip to content

Commit 6784ec2

Browse files
author
Sravan S
authored
fix: pubsub should be initialized with useState (#400)
Dont need to use `useEffect` separately to initialize use state fixes: https://sendbird.atlassian.net/browse/UIKIT-2825
1 parent 73759d9 commit 6784ec2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/lib/Sendbird.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,12 @@ export default function Sendbird(props) {
6363
isREMUnitEnabled = false,
6464
} = config;
6565
const [logger, setLogger] = useState(LoggerFactory(logLevel));
66-
const [pubSub, setPubSub] = useState();
66+
const [pubSub] = useState(pubSubFactory());
6767
const [sdkStore, sdkDispatcher] = useReducer(sdkReducers, sdkInitialState);
6868
const [userStore, userDispatcher] = useReducer(userReducers, userInitialState);
6969

7070
useTheme(colorSet);
7171

72-
useEffect(() => {
73-
setPubSub(pubSubFactory());
74-
}, []);
75-
7672
useEffect(() => {
7773
logger.info('App Init');
7874
// dispatch action

0 commit comments

Comments
 (0)