Potrzebuję pomocy :( Chciałbym napisać wrapper w #react i #typescript ale czuję się jak totalny idiota. Stack przewalony chyba cały i dalej nie widzę nawet światełka w tunelu.
export const Layout: React.FC = ({ children }: { children?: ReactNode }) => { return ({ children } as unknown) as JSX.Element; }; Wywala mi taki błąd w Chrome: > Error: Objects are not valid as a React child (found: object with keys {children}). If you meant to render a collection of children, use an array instead.
Chciałbym napisać wrapper w #react i #typescript ale czuję się jak totalny idiota.
Stack przewalony chyba cały i dalej nie widzę nawet światełka w tunelu.
To jest mój kod w #typescript:
import React, { ReactNode } from 'react';
export const Layout: React.FC = ({ children }: { children?: ReactNode }) => {
return ({ children } as unknown) as JSX.Element;
};
Wywala mi taki błąd w Chrome: > Error: Objects are not valid as a React child (found: object with keys {children}). If you meant to render a collection of children, use an array instead.
W #react wyglądałby tak:
import React from 'react';
export const Layout = ({ children }) => {
return { children }
};
#react
return children
zamiastreturn { children }
import React from 'react';
export const Layout: React.FC = ({ children }) => {
return { children };
};
W taki sposób pykło tylko okazało się, że miałem nasrane w konfigu eslinta ;)