3 ms·
I'm sure React users also know whether they are dealing with a functional component or whether they are using hooks for state management.
by tipiirai 3y ago
I'm sure React users also know whether they are dealing with a functional component or whether they are using hooks for state management.
- YuukiRey 3y agoHmmm.... I think that's because to use one of the React hooks you need to import them from React. If you create your own hook it'll eventually use something like "useState" internally, which leads you to "import { useState } from 'react'". Functional components on their own are not distinguishable from a good old Javascript function. I guess the presence of JSX and/or hooks give it away. I'd say it's half true that glancing at a random .js file it might not be immediately obvious if it's React or a function, but with some digging you should be able to find out by following the imports.
- Etheryte 3y agoThe core difference is that in that case what's happening is clear from the code, functional components start off with a function declaration whereas class components start off with a class declaration. This isn't true for Nue, you have to have read the docs to understand anything that's going on, otherwise you have no clue. In general though, while I understand it's your project and you have strong emotions towards it, looking through the rest of the comments it doesn't shine a good light on the project if you argue tooth and nail against any and every criticism. Many of the criticisms are perfectly valid, a lot of these things have been tried before and there's reasons why there were abandoned.