Aktywne Wpisy

jmuhha +15
Jak jeszcze raz uslyszę, że programiści tak narzekają na swoje zarobki (╯°□°)╯︵ ┻━┻
źródło: 1000020926
Pobierz
denazyfikacja +640
#z-------------j #l-------------j
źródło: image_picker_BE669346-2A9D-408E-95DF-5F925A3384CF-77716-000009F589942C5B
Pobierz




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 childrenzamiastreturn { children }import React from 'react';
export const Layout: React.FC = ({ children }) => {
return {