demonz's avatar

I am new to react and need help

Hi guys , I don't like the way I deal with states and I use array.map with if conditions many times in the render function , I also have duplications , I feel like my code is so messed up specially with data coming from props , is there any source to improve my coding in react and make it clear. when I first installed react , inertia js and laravel using laravel breeze it was fresh and clean and I only changed few inputs and everything was okay , but when I started to create resource controllers , passing data(from DB) to .jsx files and using array.map manytimes and create variables which might not needed , I felt like stupid. Hope u get me any source that help thanks

0 likes
5 replies
demonz's avatar

guys do u have any good plugin for vs code to organize the <TAGS> , cuz I don't know what's wrong with prettier

demonz's avatar

when I have learner_id for example as foreign key in second table and I want to display the name instead of the id , i do to array.map with two tables

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

I am a react developer using inertia. But without any code to go by it is really hard to help.

My best suggestion is to extract as much as possible to components that you can import. You can then pass in the needed data to the component, or get it inside the component using usePage()

2 likes
demonz's avatar

@Sinnbeck yeah I thought about using usePage() for shared data, but my problem is the extraction I guess

Please or to participate in this conversation.