What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2022-01-29 02:05:11
react typescript pass component as prop
interface ParentCompProps { childComp?: React.ReactNode; } const ChildComp: React.FC = () => <h2>This is a child component</h2> const ParentComp: React.FC<ParentCompProps> = (props) => { const { childComp } = props; return... Add solution -
Javascript 2022-01-28 23:20:36
add pdf in react app
import React, { PureComponent } from "react" import { Document, Page } from "react-pdf/build/entry.webpack" import throttle from "lodash.throttle" import pdf from "./pdf.pdf" class App extends PureComponent { con... Add solution -
Javascript 2022-01-27 05:00:40
how to set state when change viewport react
import React, { useLayoutEffect, useState } from 'react'; function useWindowSize() { const [size, setSize] = useState([0, 0]); useLayoutEffect(() => { function updateSize() { setSize([window.innerWidth, window.innerHeight]); } wi... Add solution -
Html 2022-01-25 22:21:45
material datepicker
import React, { Fragment, useState } from "react"; import { TextField } from "@material-ui/core"; import { MobileDatePicker, DesktopDatePicker, DatePicker } from "@material-ui/pickers"; function DatePickersVariants(props) { ... Add solution -
Javascript 2022-01-24 08:41:47
React Children map example
export default class SomeComponent extends React.Component { render() { const childrenWithWrapperDiv = React.Children.map(this.props.children, child => { return ( <div className="some-component-special-class">{child}... Add solution