r/reactjs • u/dance2die • May 01 '22
Needs Help Beginner's Thread / Easy Questions (May 2022)
You can find previous Beginner's Threads in the wiki.
Ask about React or anything else in its ecosystem here.
Stuck making progress on your app, need a feedback?
There are no dumb questions. We are all beginner at something 🙂
Help us to help you better
Improve your chances of reply
- Add a minimal example with JSFiddle, CodeSandbox, or Stackblitz links
- Describe what you want it to do (is it an XY problem?)
- and things you've tried. (Don't just post big blocks of code!)
- Format code for legibility.
- Pay it forward by answering questions even if there is already an answer. Other perspectives can be helpful to beginners.
Also, there's no quicker way to learn than being wrong on the Internet.
New to React?
Check out the sub's sidebar! 👉
For rules and free resources~
Comment here for any ideas/suggestions to improve this thread
Thank you to all who post questions and those who answer them.
We're still a growing community and helping each other only strengthens it!
20
Upvotes
14
u/shiningmatcha May 06 '22
Hi, I'm starting to work on my very first React project tomorrow. That's it. I'm just leaving a message here to keep myself motivated!
4
u/Tixarer May 16 '22
I have a React app and want to create an authentication (user create account with username and password) and store data created by the user.
What technologies do I need to implement that inside my app ?
3
u/AdmiraalSchaap May 03 '22
I'm a front-end dev with about 8 YOE and have worked mostly in the Vue ecosystem. My next role involves working with React though and I'm trying to understand the best way to use CSS in React components. Personally I don't really like Styled Components (the syntax feels so unnatural coming from Vue) and I would rather like to use CSS modules or other more 'native' CSS solutions. So 2 questions:
- are there any good React example repo's using CSS modules or similar?
- what is best practice these days when it comes to styling React apps?
3
u/ankush0024 May 17 '22
Just started learning react lets hope i am able to keep up the motivation and finish it.
2
u/bobbyblanksjr May 02 '22 edited May 03 '22
Should I use Tailwind CSS with React or should I avoid using it at all? What would be a good alternative if not Tailwind?
So it seems to not matter at all if I use Tailwind or not, thanks people!
2
u/badboyzpwns May 07 '22
I want to have a feedback mechanisms to hear from users to catch ux problems early. How can this be achieved? I'm thinking of a 'Reprot bugs' section in the footer but I'm not sure if this is the best way.
2
u/[deleted] May 13 '22
Tasked with setting up a global store utilizing useReducer. Any resources I can use (besides the official React documentation that I’m already using)?
Haven’t used useReducer before so I’m not sure how to set it up when I don’t really know what kind of objects I’ll be using.
2
u/techguyC50 May 13 '22
Hi, I'm learning Javascript and have been using react and its extensions like react hooks, react router, and redux. But I really want to focus on Vue. Is it worth it to work on Vue for some future potential jobs?
2
u/Dfree35 May 14 '22
I have a very small project using react for the front end. It maps stuff from local storage to a list with a button to delete the items in the list. I just can’t get the list to rerender/refresh/remap until I refresh the page.
Typing this out, I just thought maybe I should do the mapping to show the list and button in a useEffect instead of the render.
2
u/shiningmatcha May 15 '22
Hi, I have been learning JS, React, CSS, HTML, SQL, HTTP, Express and Node, am I prepared to build a full-stack web app with what I know?
2
u/icedlaksa May 15 '22
Any community for reactjs where I can seek help from?
I am getting lotsa errors and it's frustrating that I don't know where to get help from :(
The discord link on the sidebar is invalid.
2
u/PlaneOk4444 May 18 '22
I started learning react last year and stopped because my workload was too heavy. Want to pick it up again. What stack should I focus on?
2
u/Natty_1122 May 21 '22
Hi, am working on an online store that comprises of Projects, E-books, assignments and proposals. i need some advice on the API structure, for the models and routes.
2
u/BlendModes May 21 '22
Hi everyone, I'm a beginner and I'm trying to learn useReducer.
I'm using a reducer hook for a classic todo list app. I need to call a method to know if an item is already in the todo list. Is it possible to make a reducer action that doesn't update the state but only returns a value?
2
u/shiningmatcha May 31 '22
If I'm learning Typescript, is it unnecessary to learn PropTypes?
1
u/Tixarer May 01 '22
I'm trying to move my app over to Next.js so I'm learning about dynamic routing and data fetching with getStaticProps an getStaticPaths.
I'm looking at multiple examples on how to use them but every time there is only one API call per component and I have some components fetching data from different URL. Do I need to do a geStaticProps for every data fetch ?
Also I currently have a component with all my fetch created with custom hooks and I import them whenever I need them (like this). Is it possible to put all the getStaticProps in one component and call them in a component when I need it ?
1
u/foldingaces May 02 '22
I have a quick question about reducers, specifically useReducer. I recently made some changes to move several pieces of state into a useReducer and one of my cases for a word game looks like this:
I know reducers need to be pure functions, so I am thinking because this cases's return value relies on other pieces of state, I might need to move the logic of the first part (below) to exist outside of the reducer, maybe in some useEffect or where I am dispatching the action:
am I right in thinking this? Or is this level of complexity OK for a reducer case. If you want to see the full code it is located here: https://github.com/jamesurobertson/trumple/blob/master/src/components/Game.js
1
u/[deleted] May 03 '22
I'm getting ready to transition from a site using HTML, CSS, and Vanilla JS to a site using React, and I'm not really sure what the best way to do this transition is. My site currently runs on an Apache2 web server hosted on an AWS Ubuntu instance, but I do all the work locally before I push it up to the server. When working locally, I'm able to save a change to my code, refresh my browser, and immediately see that change in the browser. Is this something I'm still able to do with React, or do I need to re-deploy every single time I want to see a change?
1
u/[deleted] May 08 '22
I’m going to start applying for my first React position soon. In your experience, what type of company did you most enjoy your work at? A web dev firm? A tech startup? A larger company? I’m sure the dynamics of the work is entirely different at each of these examples. Would love to hear your experience and guidance!
1
u/NickEmpetvee May 09 '22 edited May 09 '22
How compatible are Material-UI and Ant? I'm on a project where the UI is governed by Material themes, but there are some Ant components that I feel work better than the Material equivalent (e.g. https://ant.design/components/tree/#components-tree-demo-draggable). I'd like to use the provided Material theme in combination with this Ant component, and was wondering if anyone has done that mix and match.
1
u/ApplePieCrust2122 May 10 '22
Any medium/large real world open source websites/apps that use tailwindcss, to learn from?
1
u/foldingaces May 10 '22
I'm creating a word game and am currently using two useReducers, one for the game state, and one for statistics. Is it okay to have something like the following in some parent component or is it best practice to combine these reducers someway?
1
u/El_Daidel May 13 '22
Hey guys, I recently started a react project and until now I managed most things with help of google, but now I am stuck.. I want to integrate some nice charts but cant seem to find a good library for charts that is compatible with react-18.. The only thing that kind of works is echarts-for-react but it is so complicated, I feel like there must be something better. Does anybody have an idea what libraries I can look at? Cheers!
1
u/shiningmatcha May 14 '22
Why should I use
onClickinstead ofonclickas in ordinary HTML?1
u/shiningmatcha May 14 '22
How do I access the HTML attributes passed to my React components? How does React tell if I intend to specify real HTML attributes or pass props to my components as syntactically they're the same?
1
u/Mr_Nice_ May 15 '22
I am looking for a drag and drop editor that allows custom components to be created. What I mean is there is stuff like retool that let you build an interface quickly but I want to be able to choose my own component pack. So for instance when I drag a button onto the screen I can create my own button code that depends on component library of my choice. I really like these tools for quick prototyping but for me they are not useful as they don't use the components packs that I like to work with.
1
u/foldingaces May 16 '22
I have a question about prop / variable naming conventions in react.
I'll lead with an example. Say you are making some guessing game and there is a board made up of rows (completed, empty, etc). Your Game component might look like this:
Is it best practice for the prop variable to be named guesses or something more generic like 'completedRowValues'?
The former 'guesses' is more specific to this app, while 'completedRowValues' would be more generic.
I like the first one, 'guesses', because it ties the Board to this specific app with the naming conventions.
I like the second one, 'completedRowValues', because it keeps the Board pretty generic, it doesn't know it's being used in a guessing game and doesn't care what kind of data is being passed to it, just that it has some data to fill in it's "Completed Rows".
I'm curious on your thoughts. Thanks for reading!
1
u/Timberhochwandii May 16 '22
Hello, I'm a beginner React Developer and I wondered when I should start learning how to use TS with React. I have learned about and built projects with State: (useState, useReducer), Conditional Rendering, useEffect, Context API, React Router and handling HTTP requests/API
1
u/Undescended_testicle May 17 '22
I feel this is a stupid question. I'm deploying a react app to a windows server, running IIS. Do I need to install node.js on the server for the site to run?
1
u/simbolmina NextJS App Router May 18 '22
I got my first job as a web developer for a gaming company. They expect me to create their web pages for costumers and in-house application.
I will start working on their main website for costumer. It's not a complicated page but there will blog posts for news and events. So Its kind of a heavy content page.
I will create the page with NextJS but they want editors and marketing staff be able to add news and events to page by themselves so working on a IDE and pushing new content is out of question.
I tought using Wordpress CMS or adding an editor page just to serve adding content. What solution do you think would be best for this?
1
u/shiningmatcha May 21 '22
In what order should I define a class component's methods?
1
u/FuzzyFun9130 May 22 '22
Hi! Should i use Formik with Ant Design? Or just stay with one of them while i'm creating a form?
1
u/Tixarer May 24 '22 edited May 25 '22
I have a react app with two themes : light and dark.
When the theme is set to dark and a page is loading, it displays the white theme and then goes to dark theme.
I looked up for a solution and I found "implementing ssr". Will it solve my problem ?
I thought about putting dark theme by default but the problem will still be there when I use the light theme.
Edit : i'm using styled-components
1
u/shiningmatcha May 24 '22
What do you think of this statement? I saw this on SO.
It is also said that you can create KeyboardEvent in React. But what does that actually mean? So
SyntheticEventis a must-learn before I can use most of the browser events?1
u/k2718 May 25 '22
We have a React application and we need to use some of the functionality on the back end either as a web service or a script.
Is there a way to instantiate a specific component in Node without the browser?
1
u/allwxllendswxll May 26 '22
Sorry if this has been asked before.
If you were learning React in 2022 for the first time, would you still take the time to learn Class Components or would you go straight to Functional Components?
Is it still worth it learning class components?
1
u/shiningmatcha May 27 '22
How do I know what HTML elements have different attributes and behaviors in React?
1
u/NickEmpetvee May 29 '22
React 17.0.2
Hi guys. The below is yielding an
onchange Uncaught (in promise) TypeError: e.persist is not a functionerror when I select a value from the dropdown. Is it ok to not include thee.persistcall? I pasted this from an online example.1
u/jssmith42 May 31 '22
Very simple: if text in my editor has actual line breaks in it (via me pressing the Enter key), but I’d like to log it to console and see those newlines as “\n”, how could I convert those newlines to “\n” literals? Thank you
1
u/Ak0710 May 16 '22
Hi Guyss, after having a good grasp on vanilla js. I have decided to learn react but confused between whether to learn react 17 or react 18 ? can anyone share their opinion on which version should I go ahead with as a beginner?
1
u/handler2325 May 23 '22
hey guys, the most important question i have now:
is it worth learning react js and other skills where web3.0 is coming are we gonna have a job or opportunity ?!
2
u/shiningmatcha May 15 '22
React doc says a React component can also return an array of elements, like this code:
So we don't need
React.Fragment? What's the difference between wrapping children inReact.Fragmentand putting them in an array then?2
u/shiningmatcha May 22 '22
What's the default state for
useStateif I don't provide the initial state?2
u/[deleted] May 23 '22
I need to build a form to onboard users, this form is going to be quite long and cumbersome for users to fill out so I want to build it in a way that breaks it into parts, with some kind of nice presentation style flow for the user to enter details, one that saves state where a user can come back to it and complete it later.
Can anybody suggest a library for this?
Basically a customer onboarding library
2
u/[deleted] May 27 '22
How can I pass a variable on inline style ReactJS?
This is my HTML FILE
How can I apply this to REACTJS? I want to pass --i: 0 to --i: 7. Can someone help me?
<li style="--i: 0"><a href=""><ion-icon name="home-outline"></ion-icon></a></li><li style="--i: 1"><a href=""><ion-icon name="person-outline"></ion-icon></a></li><li style="--i: 2"><a href=""><ion-icon name="settings-outline"></ion-icon></a></li><li style="--i: 3"><a href=""><ion-icon name="mail-outline"></ion-icon></a></li><li style="--i: 4"><a href=""><ion-icon name="key-outline"></ion-icon></a></li><li style="--i: 5"><a href=""><ion-icon name="videocam-outline"></ion-icon></a></li><li style="--i: 6"><a href=""><ion-icon name="game-controller-outline"></ion-icon></a></li><li style="--i: 7"><a href=""><ion-icon name="camera-outline"></ion-icon></a></li>1
u/[deleted] May 01 '22 edited May 01 '22
So, I'm a beginner and trying to use react-horizontal-slider . I'm using a .json file to import data. The data shows up correctly but the cards are stacked instead of being horizontal and slidable.
EventsMenu.js is the component with the slider.
events: the resource from the json file
This is the parent component
HomePage.js
Only CSS used is for HomePage.js
1
u/computerash May 04 '22
So I want to learn React with Express. I want to make a small login page that when a user isn't logged in it will show a login/signup screen but if a user is logged in it will show the home screen. Can someone link a resource to learn about authentication with react router.
1
u/post_hazanko May 04 '22
If you're just flipping
useStatebooleans likesetRectangeRotate(true);setRectangleFill(true);setRectange...If none of those methods are asynchronous, they just happen, is there still a possibility of them occurring out of order?
1
u/LoseAndImprove May 04 '22
Hello everyone, sorry if this is the wrong place to ask but is there any place where one could find some react project challanges, by that I mean a simple screenshot of a desired webpage/app with maybe a few assets like the background picture or whatnot available to d/l. I finished the scrimba frontend webdev course and even tough the next step according to them is looking for a job, i'd like to have atleast 2-3 solid "complex" projects behind me to gather confidence to start job hunting.
1
u/Cioccoluna May 05 '22
Hey everyone! I'm programming a website with react and want to highlight the "active" section in the navbar. It's a navbar that links to anchor points, so it should be able to detect where I scrolled to. I tried using
NavHashLinkfromreact-router-hash-linkbut the highlighting doesn't work - since I'm on the same page, all menu items have the "active" class... plus I get a weird error message in the console from it that I don't understand:Warning: React does not recognize the \\isActive\prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase \\isactive\instead. If you accidentally passed it from a parent component, remove it from the DOM element.I don't know about an isActive prop... I'm not using one? This only appears when I use this react-router-hash-link.
Maybe someone knows what my mistake here is or knows a better way to do this?
Thank you so much in advance for any help!!
1
u/TODO_getLife May 06 '22 edited May 06 '22
Am I being dumb, how do I add a key/value to an existing object?
This is what I have.
So how do I do it?
I know with an array I can array.push(); but I have no idea how to do it with objects.
To be clear I don't want to do this:
Basically my use case is updating state, but I need to do it at multiple points in a function. So I want an empty object to put all the new keys into, then I will do the ...oldObject, newOjbect to put them together, then update state. Is that possible?
1
u/devlasol May 07 '22
Hope this is enough info , but I'm setting the state of an update form using Formik. Getting the data from another component using useNavigate/useLocation, which is probably a whole different problem/post. Long story short: the data is coming from a react-table; in this table, I needed to convert a DateTime using toLocaleDateString(). Mission accomplished. But now when it's coming back in my Update form, it's naturally showing as DateTime again (so "2022-04-05T00:00:00" instead of "4/5/2022"). I've tried: date: briq.date.toLocaleDateString(); date: (briq) => new Date(briq.date).toLocaleDateString().. and variations of these two.
Is there even a way to convert it in the initialFormValues? Or would I have to do it in a whole separate function with a setInititialFormValues?
1
u/TODO_getLife May 10 '22
Is it possible to loop over an array of strings and return objects?
If I have ["Tom", "Micheal", "Steve"] as an array.
Can I turn it into
and the same for each string in the array. This is what I've tried but the syntax might be wrong for a start:
I assume after this this whatever const will be an array of objects but I can't get it to work currently.
1
u/ketalicious May 15 '22
Hello guys, I wanna ask how do I customize the youtube video player (from youtube embed iframe) or any library I can use to interact with it? I also wanna add that I am using react-youtube library but i haven't made it work due to the cors error (refer to this issue) and it seems like an obscure problem for me (I am using next.js 12.1.5 ). I would be glad for any responses!
1
u/shiningmatcha May 15 '22
Should I always use
<img onClick={myFunc} />instead of<img onClick={(e) => myFunc(e)} />?1
u/[deleted] May 16 '22
What's the difference between these parameters when passing into a component?
I have also tried the following, but it didn't work for me
1
u/Eponahp May 17 '22
Hello guys! I'm starting a ReactJS course, I installed Node.JS as mandated, but it shows me this error, does anyone knows what it can possibly be? Thank you!
C:\Users\Tuma\Desktop\reactJS_project\Muchos sanguches>npm install -g create
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'create@0.0.2',
npm WARN EBADENGINE required: { node: '>= 0.4.0 && < 0.7.0' },
npm WARN EBADENGINE current: { node: 'v16.15.0', npm: '8.10.0' }
npm WARN EBADENGINE }
changed 1 package, and audited 2 packages in 1s
found 0 vulnerabilities
C:\Users\Tuma\Desktop\reactJS_project\Muchos sanguches>
1
u/MissionChipmunk6 May 17 '22 edited May 17 '22
Got a question about why using callback functions in setStateVariable is best practice. I wrote out an example below:
Example of using setState as a beginner:
So here we modify the state variable without a callback in setCount.
Example of using setState with best practice:
Here there is a callback function that returns a value for setCount to use. Why is this best practice?
1
u/shiningmatcha May 17 '22
Are these two JSX equivalent?
<li>{myBool && 'This is only displayed when myBool is true'}</li>{myBool && <li>This is only displayed when myBool is true</li>}1
u/eyememine May 18 '22
Hello, I am having this problem where I send a function from a parent functional component to a child functional component (along with some data) and it keep telling me the function is not a function. Can anyone please help me and figure out what the heck is going on here? I have submitted some code snippets below, thanks! Please note these are on different files
1
u/shiningmatcha May 18 '22
What is
React.DOM(not ReactDOM)? I can't find it in the docs.1
u/shiningmatcha May 18 '22
In JSX, why do I not need to surround a string prop with curly braces?
I mean, why is it ok to write
<img src="./example.jpg" />instead of<img src={"./example.jpg"} />?1
u/Tixarer May 18 '22 edited May 18 '22
I have a working inifinte scroll implemented with the infinite-scroll-compinent package.
The problem is that I'd like to limit the numbers of items loaded (for example it can loads 300 items but i want it to stop at the 100th item).
Here's my code :
const [hasMore, setHasMore] = useState(false);
const fetchMore = () => { if (filteredPokedex.length < 100) { setHasMore(true); } };
<InfiniteScroll dataLength={pokedex.length} next={() => setLimit(limit + 25)} hasMore={fetchMore} endMessage={<Loading>No more pokémon</Loading>}
So when the length of the loaded items is under 100, "setHasMore" is true and keeps loading items but when it's above 100 it becomes false and displays the endMessage but, instead, it keeps loading items.
What's wrong with my code ?
1
u/shiningmatcha May 19 '22
Can someone explain the need to bind
How does
thishelp in updating the overall component state?1
u/eyememine May 19 '22
Hello everyone. I can't see to figure out how to filter an array from items in a sub array. For instance below I have people in an array and they each have tags, and I want to filter the ones for when I search lets say "a" (which should come back as Steve only). What am I doing wrong here, thanks!
1
u/Unchart3disOP May 19 '22
Hi guys,
I have been deployed in the army for the past year doing almost zero coding whatsoever, now I want to return back to the industry having finished my service, thankfully the market has moved away from Angular to React/Vue at this point and I'd like to leverage this opportunity to get ahead of the curve and learn Next + React + Redux and whatever libraries are trending at the moment. Now before my service I used to have a full time FE job where I used Vue, VueX, tailwindCSS so I am not all that new to Frontend.
What I found was however, is that I almost forgot everything, I can barely write two lines of code, so what do you guys suggest I'd do? Go over leetcode and solve some problems or do you think I should jump headfirst and I'd get my knowledge back as soon as I get my hands used to Javascript and React?
Also, I am not sure what projects should I do -after familiarizing myself with coding-,
On one hand, if I build a big project, say like an E-commerce website, I probably would learn LOTS, but the problem would be is that the application would also require a backend and a good one in fact, to handle all these requests/images...etc which would shift my focus away from React/Next or Frontend in general,
and If I build a small app, It would just be so small that I can barely learn a thing, so I am confused on what sorta projects I should be doing to improve myself, so any project ideas would be very welcome for my case! :D
So to put everything in a nutshell
Thanks!
1
u/deepak8717 May 20 '22
Hi guys,
i have <Sidebar /> and <Recipe> components, sidebar contains the menu like "breakfast", "lunch" ..... and <Recipe /> renders the list of recipes based on sidebar input
Now my route looks like localhost/menu and it works fine but i want to break it further like localhost/menu/breakfast . i don't know how to achieve that without creating a separate component based on each subcategory.
1
u/YouFromAnotherWorld May 21 '22 edited May 21 '22
Hello. I'm using NextJS and I'm getting the string 'mockServiceWorker.js' in my getStaticProps context params (pages > [id] > index) every time I refresh the page, even though I'm in the root index (pages > index). Yesterday it wasn't there but now it is. I don't think I changed anything. Do you have any idea why that appears?
EDIT: I moved the file to another folder and it doesn't appear anymore, but I'm still curious about why it happened.
1
u/wy35 May 24 '22
Is it safe to modify the callback parameter in the useState setter? e.g.
1
u/-Bluekraken May 26 '22
We've been using react at work for simple apps (get data => show data). Now we're making our own "framework" or set of tools and reusable/extendable components, to be more agile in generating products with various levels of complexity (Like a reusable and extendable searchable select).
I'm the main developer and there are some things like patterns for reusable components and children orchestration that seems a lot less straightforward than just making a couple of components in a page show data and react to changes. But taking the right approach seems like a matter of where you want your tech debt to be.
Is there a go-to book, piece of literature, author, or course, that is good and updated enough to have as a reference to assist in the design of our products?
1
u/kitsunekyo May 26 '22
lets say you have routes like p/:projectId/* wherein theres dashboard, settings, etc. all the data for these views is fetched at once. maybe on the view with the p subroutes. when would you guys refetch the api data? on every route change within p/:projectId or only when projectId changes?
1
u/shiningmatcha May 26 '22
When using useEffect, what variables should I put into the dependency array (the second argument)? React docs say If you use this optimization, make sure the array includes all values from the component scope (such as props and state) that change over time and that are used by the effect. What does that mean?
1
u/GravityTracker May 27 '22
I'm having timing issues trying to do a postMessage to an iframe. Here is a snippet of the component, and a sample of the html displayed in the iframe. NOTE: I know there are security concerns about some of the configuration. Just trying to get it working first.
The idea is that we are passing data from the parent component to the iframe via Window.postMessage().
When I run the app, the iframe does not receive a message. If I put a breakpoint at line 10, it will receive the message as intended.
I've tried not using a useEffect
I've tried using [ ] as the dependency list.
What it seems like I should do is have some sort of trigger when the iframeref is set, then post the message, but I don't know how to do that.
1
u/bottomlesscoffeecup May 29 '22
Hi guys, trying to hook up a button to open close a drawer using redux with slices, not sure I am understanding things correctly. Made a stack overflow post, could anyone advice? :)
https://stackoverflow.com/questions/72422291/redux-click-on-iconbutton-to-open-close-drawer-using-slices
1
u/shiningmatcha May 29 '22
The docs say
useRefis for instance variables. What aboutuseState? Aren't states instance variables too?1
u/Undescended_testicle May 30 '22
I have a react application that makes use of a components package put together by my firm. Other packages are taken from npm.
When I try to build my application in OpenShift, the company's package annot be found, and therefore the build fails.
On my work computer I can of course install this package, but will not be able to access it within OpenShift.
What is the best strategy to get around this? I thought of two options:
Which is best do you think?
1
u/NickEmpetvee May 31 '22
Hi guys,
I had the following working code in a React 17.x project. It disables backdrop clicks in Material-UI 4.12.x. I copied it to another codebase with the same React version and it is telling me:
'onClose' is not defined.eslintno-undef. Any suggestions on how I can resolve? MUI suggests doing it the below way...The code:
1
u/shiningmatcha Jun 01 '22
From React's point of view, is the difference between a function component and a function that returns JSX only in the naming? So React considers any function with a capitalized name a function component?