Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import React, { useContext } from 'react';
  2. import { ThemeContext } from '../';
  3.  
  4. const ContextHookMiddleUse = () => {
  5. const value = useContext(ThemeContext);
  6.  
  7. return (
  8. <div
  9. style={{
  10. backgroundColor: value === 'light' ? 'white' : 'black',
  11. color: value === 'light' ? 'black' : 'white',
  12. }}>
  13. Context Middle Use
  14. </div>
  15. );
  16. };
  17.  
  18. export default ContextHookMiddleUse;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement