question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

We should use React hooks once they land in a stable release! Here are a couple first ideas:

  • Rework theming system to be based on useContext to avoid DevTools bloat with ThemeConsumer components
  • Implement useTheme hook (see #2340)
    • Maybe remove withTheme HOC in favor of the hook?
  • Rework StyleSheet infrastructure to use hooks

Any other ideas for how we could leverage hooks?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:56
  • Comments:27 (14 by maintainers)

github_iconTop GitHub Comments

33reactions
probablyupcommented, Jan 21, 2019

Something like:

const className = useStyle`
  color: ${p => p.theme.colors.red};
`;

Is that possible, using a TTL as a hook?

22reactions
sibeliuscommented, Apr 12, 2019

is this enough to get theme?

import { useContext } from 'react';
import { ThemeContext } from 'styled-components';

export const useTheme = () => {
  const theme = useContext(ThemeContext);

  return theme;
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

useHooks - Easy to understand React Hook recipes
Hooks are a feature in React that allow you use state and other React features without writing classes. This website provides easy to...
Read more >
Hooks at a Glance - React
Hooks are functions that let you “hook into” React state and lifecycle features from function components. Hooks don't work inside classes — they...
Read more >
streamich/react-use: React Hooks - GitHub
React Hooks — . Contribute to streamich/react-use development by creating an account on GitHub. ... Collection of essential React Hooks.
Read more >
usehooks-ts
Welcome to the documentation of usehooks-ts, a React hooks library, ready to use, written in typescript.
Read more >
Useful React Hooks That You Can Use In Your Projects
Hooks are simply functions that allow you to hook into or make use of React features. They were introduced at the React Conf...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found