background-image in react component

You have to import the image as the following, using the relative path. import React from ‘react’; import Paper from ‘material-ui/Paper’; import IconButton from ‘material-ui/IconButton’; import ActionHome from ‘material-ui/svg-icons/action/home’; import Image from ‘../img/main.jpg’; // Import using relative path const styles = { paperContainer: { backgroundImage: `url(${Image})` } }; export default class Home extends React.Component{ render(){ … Read more

Property does not exist on type ‘IntrinsicAttributes & { children?: ReactNode; }’

// This is the piece we were missing ——————–v const connect = function (Component: React.FC): React.FC<Props> { const ComponentWrapper = function (props: Props): JSX.Element { return <Component {…props} />; }; return ComponentWrapper; }; and after restarting the compiler it’ll work fine. The type of the return value of the connect function is a functional component … Read more

NextJs – Link to scroll to a section in same page

In vanilla HTML you’d do something like this <a href=”#first-section”>My first section</a> <a href=”#second-section”>My second section</a> <div id=”first-section”>SECTION 1</div> <main id=”second-section”>SECTION 2</main> In NextJS you’d so something similar. Instead of using the anchor tag for linking, you’d use the Link components. <Link href=”#first-section”>My first section</Link> <Link href=”#second-section”>My second section</Link> <div id=”first-section”>SECTION 1</div> <main id=”second-section”>SECTION 2</main> … Read more

How to make a functional React component with generic type?

You need to rewrite your Test component in this way const Test= <T,>(props:TestProps<T>) => ( <span>Some component logic</span> ); Can you show the same with React.FC<TestProps>? It is impossible to do with FC. This is FC implementation: interface FunctionComponent<P = {}> { (props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null; // … other static properties … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)