Skip to content

Instantly share code, notes, and snippets.

View lmosele's full-sized avatar
🍉

Lucas Mosele lmosele

🍉
View GitHub Profile
@lmosele
lmosele / Usage.js
Created July 8, 2019 21:07
React On Click Outside of Element Hook
// clicking outside of div will hide <p>
const Menu = props => {
const { ref, isComponentVisible } = useComponentVisible(true);
return (
<div ref={ref}>
{isComponentVisible && <p>{props.children}</p>}
</div>
);
};
@lmosele
lmosele / Framed.js
Created October 4, 2019 14:30
Styled Components with React Frame
import React from "react"; // "react": "^16.8.6",
import Frame, { FrameContextConsumer } from "react-frame-component"; // "react-frame-component": "^4.1.0",
import { StyleSheetManager, withTheme, ThemeProvider } from "styled-components"; // "styled-components": "^3.3.3",
export default withTheme(props => {
const { theme, style = {}, children, ...rest } = props;
return (
<Frame
style={{
display: "block",
@lmosele
lmosele / test.svg
Created December 11, 2019 04:01
testing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.