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

How to resolve aliases in Storybook?

Just add this in your .storybook/main.js const path = require(‘path’); module.exports = { “stories”: [ “../components/**/*.stories.mdx”, “../components/**/*.stories.@(js|jsx|ts|tsx)” ], “addons”: [ “@storybook/addon-links”, “@storybook/addon-essentials”, ‘@storybook/preset-scss’, ], webpackFinal: async (config) => { config.resolve.alias = { …config.resolve.alias, ‘@/interfaces’: path.resolve(__dirname, “../interfaces”), }; return config; } } here interface is folder at my project root It works For Me

nextjs – next build with NODE_ENV=development

UPDATE 2022-11-23: See how-to-set-environment-variables-from-within-package-json. In short: “start:dev”: “NODE_ENV=development next start” You might need cross-env (on Windows ? I don’t know): “start:dev”: “cross-env NODE_ENV=development next start” More specific documentation is now available (and maybe requirements also have changed, or maybe not): environment-variable-load-order: … Note: The allowed values for NODE_ENV are production, development and test. non-standard-node-env: … … Read more