Skip to content

Instantly share code, notes, and snippets.

View audiolion's full-sized avatar
⌨️
coding

Ryan Castner audiolion

⌨️
coding
View GitHub Profile
import qs from 'query-string';
import { useHistory, useLocation } from 'react-router';
function useSynchronizeQueryParams({ topic }) {
const { search, pathname } = useLocation();
const history = useHistory();
const params = qs.parse(search);
React.useEffect(() => {
<div css={{
color: 'red',
...(isActive ? color: 'blue' : {}),
}} />
<div css={[
{ color: 'red' },
isActive ? { color: 'blue' } : undefined,
]} />