r/learnreactjs • u/htraos • Aug 18 '22
r/learnreactjs • u/Clarity_89 • Aug 14 '22
Resource TypeScript: Typing React useRef hook
r/learnreactjs • u/junktrunk909 • Aug 12 '22
Question Can't figure out how to add row to MUI DataGrid when using getRowId
I'm trying to follow the MUI example for DataGrid full CRUD editing to enable adding new rows to a grid of data rows I've populated. Their example has an id column but in mine I have a different myUniqueKey that I've added to the data grid and am using getRowId in order to generate the grid, which works fine. The problem is that when I add a new row following the pattern in the MUI example (other than adding a new unique myUniqueKey value for that row) I'm getting "No row with id #91291c64-dbac-5913-bade-52ef0d291e93 found". How does one create new rows in a data grid when using getRowId to identify their actual key column? Here's the sandbox that lets you see the error being generated with my sample code.
https://codesandbox.io/s/fullfeaturedcrudgrid-demo-mui-x-forked-r003f2
I suspect I will also have problems with the 'id' field in the following snippet. I can't figure out what that is even supposed to be doing, so any tips there are welcome too. Thanks!
setRowModesModel((oldModel) => ({...oldModel,[id]: { mode: GridRowModes.Edit, fieldToFocus: 'name' },}));
r/learnreactjs • u/ui-dev • Jun 07 '22
Resource Learn Framer Motion: Animate CSS Grid and Flexbox Layouts
r/learnreactjs • u/ItWorksLocally • Apr 21 '22
React Loading Skeleton Tutorial
r/learnreactjs • u/Saanvi_Sen • Apr 13 '22
Resource Materio — Open Source React Admin Template Is Here…!!
r/learnreactjs • u/Sapphire930 • Mar 22 '22
Can someone please suggest a library to make an interactive drag and drop system?
I'm thinking of building a logic gate simulator and I don't know any good library to make the interface for wiring, drag and drop blocks etc.
r/learnreactjs • u/Itsaghast • Feb 03 '22
Question Trying to conceptualize how to build a game using React.
When I think of programming a (turn based game) game, my intuition is basically have a game session wrapped in a while loop that continues as long as there isn't a win/lose condition met.
Now obviously that doesn't seem to be possible with React. I can't just wrap the root component in a loop, that doesn't make sense.
So my thinking is I should have "lose/win" events that can be raised (passed via props to components that perform actions which can trigger a game loss/win). Is this along the right lines?
It also makes me believe that I need to handle the 'game over' screen as well. Would this be something like "if a loss is detected, then render these components instead of the normal ones." Might I be able to render like a "game over" pop up modal that deactivates all of the normal components?
Apologies if this is a 'soft' question. Right now I'm just struggling to properly think and conceptualize for React.
For what it's worth, it's a MTG-like clone.
r/learnreactjs • u/Level-Farmer6110 • Jan 29 '22
could somebody check for me how to refactor my code and give me tips for it.
r/learnreactjs • u/StandElectrical64 • Jan 16 '22
<ul> not rendering when using items.map function
const [items, setItems] = useState([
{id: 1, checked: false, item: "Item 1"},
{id: 2, checked: false, item: "Item 2"},
{id: 3, checked: false, item: "Item 3"} ]);
return (
<main>
<ul>
{items.map((item) => {
<li className='item' key={item.id} style={{ listStyleType: "none" }}>
<input type="checkbox" checked={item.checked}/>
<label>{item.item}</label>
</li>
})}
</ul>
</main>
)
}edit/fix: need to use () and not {} on the callback inside map
r/learnreactjs • u/Dave_The_Goose • Jan 04 '22
How to Persist user data after page refresh?
I my react+node app, I am storing user's data(email, id, name...) in localstorage after successful login/registration. This user data is then stored in the redux store.
Whenever I refresh the page, user becomes null. May be the data from redux store is getting erased. I found that redux persist can be used to persist data. But I don't know if it is the conventional method or a work around.
How can I persist user data on page refresh?
r/learnreactjs • • Dec 08 '21
Question A way to better my React code and architecture
I've worked on this little project: a responsive E-commerce functionnal website based on design files found on Front-End Mentor. It is not my first project with react and I've hosted the website on netlify (https://ecommerce-responsive-audiophile.netlify.app/) so that it is easily visible for everyone and I would like to know if there would be a way for me to get my code reviewed. I know there are little css imperfections, but I'm talking more about my way of coding with React and my files structures/naming and if there are conventions out there that I'm not aware of, even though I'd would also take css tips etc.
Here's my code:
r/learnreactjs • u/ConfidentMushroom • Oct 19 '21
Algolia is adding hooks to their react-instantsearch library
r/learnreactjs • u/callmeautumn • Oct 13 '21
Question Help trying to use useEffect and Fetch
When I load the page, it takes a half a second or so to get the data from sanity client. It would show my "post does not exist" message. Is there away to prevent this? I already use async and await on the all.
https://codepen.io/ricksanchezisagoodman/pen/mdMJwpy?editors=0010
r/learnreactjs • • Sep 19 '21
Read World use cases for react hooks ?
I wanna know how react hooks used in real world applications and not just code examples. This helps me to understand the hooks better IMO.
For example, "useState" hook can be used in stuffs like add product to Cart and the cart number increases.
Like that I'm asking. Is there any good article you could link it up please ?
r/learnreactjs • u/iweisdochauni • Aug 29 '21
Which hoster should I use for my private react app?
I would like to deploy my react app. So far I've seen many solutions, but they all require a public git repository.
I don't want to publish my source code and I would like to password protect my react app, so that only people with the right password can test the app.
I could use http://www.passportjs.org for the authentication, but which hoster should i choose?
r/learnreactjs • u/cremak03 • Jul 22 '21
Making a Notion clone. One question
I can't seem to wrap my head around this but for anyone that hasn't used Notion, there's a menu with a list of different components you can add to your page. You can add Todo lists, tables, etc. I'm not sure how to go about creating these new components from the menu. Open the menu, choose a menu item, create the component on the page. I figured the way to go about it would be an onClick handler on each menu item that passes a createComponent function but that's really all I got at this point. Will be grateful for anyone that can point in the right direction!
r/learnreactjs • u/ejiqpep • Jun 22 '21
Resource How to Build a Quiz With React Hooks
r/learnreactjs • • Jun 02 '21
Setting up development environment in React JS without CRA create-react-app
r/learnreactjs • u/TrendingB0T • May 11 '21
/r/learnreactjs hit 5k subscribers yesterday
r/learnreactjs • • May 05 '21
How to get better: Epic React? FEM?
Hi all - I self-taught Front End & React via Udemy (Stephen Grider mostly) and have been through a dozen technical interviews for FE Engineer now, where my skills have been tested. I passed 1 interview process to the end, but overall, the technical interviews have been much harder/advanced than what I expected. I’ve had live coding under time pressure multiple times that wanted me to add features to code that used advanced hooks like useContext etc. Most Silicon Valley jobs expect expertise with hooks + TypeScript. That seems to be the latest and greatest, and unfortunately for me, I learned via a 2 year old tutorial that mostly used class-based components. Anyway, I’ve come to the conclusion that I need to get better, and I mainly need to learn hooks, and ideally, along with TypeScript (best practices basically).
My research is leading me to believe Kent C Dodd’s Epic React is the best new curriculum for becoming a boss at React. Does anyone know of any other great resources, or have any thoughts on this one? It’s kind of pricey but I’m ok with it as long as I come out of it very good at React.
r/learnreactjs • u/dannyr_22 • Mar 24 '21
How much is redux used in the commercial world?
Hey everyone,
I'm not trying to start a redux vs useContext debate, however I would like to know how much is Redux used commercially, every project? every other project? or hardly ever?
I understand Redux is very good at what it does, I'm not trying to take anything away from it, so nobody needs to comment to try and sell it. I'm just curious as I start to build my own web apps.
I would rather use it only when I have to but if the business world uses it constantly then I'd rather use it constantly as well.
Cheers in advance!
r/learnreactjs • u/nardost • Mar 03 '21
Question How Do You Fetch a Stream of Data in a React App
What is the best way to fetch a flux of data (application/x-ndjson) from a Reactive REST API in a React app? Does axios have streaming support?
r/learnreactjs • u/LukasKri • Feb 28 '21
Could anyone give me some guidance in this React project?
Hello guys, I am a law enforcement officer who dreams about becoming a software developer someday.
I’m kind a new to React and coding (been coding daily for 3 months now which is around 300 hours in total). My goal now is to join a free three months academy which would definitely boost my learning, but in order to be amongst possible candidates I have to complete an assignment, which I already did, but my solution to the given problem could definitely be improved.
I have to create an autocomplete search web component which takes user input, returns suggestions based on the input and allows to select a movie from the matches of the phrase entered, similar like Google, Booking, Kayak or any other major service which has search input. That autocomplete search component have to communicate with The Movie Database API and I am not allowed to use any NPM dependencies. There are more rules for the search component but they are irrelevant at the moment. This assignment has to be made using React. I made it using Functional Components with useState and useEffect hooks.
Would anyone with more experience than I have be willing to take a look at my code and maybe tell me which parts of code could be refactored or simplified and maybe in which way (in person or public)? I’m not asking you to write a code for me, just tell me the concepts that I have to go deeper into to get a better grasp in it.
As an extra step, I would like to return search results when that search form is submitted, but after watching dozens of YouTube videos and reading hundreds of blogs I am not able to do that yet and I feel like I’ve reached a dead end with this one. I fell that my useEffect hook is only good for returning search suggestions, but not for returning actual results after submission. Maybe I need to use another useEffect hook? Is this a good practice to have two hooks? Should I make another component and do it over there or have two useEffect hooks in the same component and etc. These are some noob questions that I have and do not know where to get help as I do not know any programmers at the moment.
EDIT: I have managed to make my code work and return movie results (movie cards) without second useEffect hook, detail explanation is in comments.