Why react code is very complex? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why react code is very complex?

I tried to learn react but and created a counter it took about 15 lines but in angular It took only 2-3 lines?

3rd Jul 2020, 5:04 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
33 Answers
+ 20
Show your 2 line angular and 15 lines react, then we can making judgements. I can make react counter in 1 line.
3rd Jul 2020, 5:07 AM
Calviղ
Calviղ - avatar
+ 8
Vinayak I think this is where I would like to stop you. If you like angular then stick with it and if you like react then stick with it. What you're doing is wasting time comparing React and Angular.
3rd Jul 2020, 5:47 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 7
Vinayak I have worked on both Angular and React enterprise level applications , I find Angular appealing in terms of completeness , it has got everything observables to handle async state , dependency injection, reactive forms and what not , but in React I particularly like the simplicity , compare the lifecycle of both Angular and React and you will know what I mean, apart from that state management is pretty solid in React with react-redux , well that can also be implemented in Angular , since its an concept but I have not seen it yet... One more thing is you break down your code in components so everything in code is manageable. React is definitely better for individuals who know just JS (*ES6 **wink**) Where as for Angular , you will need to know Typescript...... Just a suggestion use functions in ReactJS for components
3rd Jul 2020, 7:06 PM
Kalo 'smi
Kalo 'smi - avatar
+ 4
const Counter = () => { [counter, setCounter] = useState(0) increment = () => setCounter(counter++) } This is react
3rd Jul 2020, 5:24 AM
Calviղ
Calviղ - avatar
+ 3
I don't know angular, because their code is very complex.
3rd Jul 2020, 5:25 AM
Calviղ
Calviղ - avatar
+ 2
Now you are saying angular is complex i think it is easier than react
3rd Jul 2020, 5:26 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 2
Angular is more complex than react
3rd Jul 2020, 5:28 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
+ 2
React is easier than angular
3rd Jul 2020, 5:28 AM
Calviղ
Calviղ - avatar
+ 2
Have you tried to write angular code in cli also very simple
3rd Jul 2020, 5:29 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 2
I'd used angular for 6 months, before switched to react. I never look back once i know react.
3rd Jul 2020, 5:31 AM
Calviղ
Calviղ - avatar
+ 2
Really
3rd Jul 2020, 5:31 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 2
I have also used react for 2 months state management is time consuming but in angular it is easy because it creates all tasks by itself
3rd Jul 2020, 5:32 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 2
React Hook won't confuse you
3rd Jul 2020, 5:36 AM
Calviղ
Calviղ - avatar
+ 2
Have you created a database in angular with use of nestjs and typeorm It's very easy tell me about react
3rd Jul 2020, 5:41 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 1
Ok
3rd Jul 2020, 5:08 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 1
class Counter extends React.Component { state = { counter: 0 } increment = () => { this.setState({ counter: this.state.counter+1}); } render() { return <div> <p>{this.state.counter}</p> <button onClick={this.increment}>Increment</button> </div>; } } This is react
3rd Jul 2020, 5:12 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 1
export class appcomponent { counter =0; increment() { this.counter++; } } This is angular
3rd Jul 2020, 5:13 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 1
But what about angulat
3rd Jul 2020, 5:24 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar
+ 1
Have you tried to write react code in hooks also very simple
3rd Jul 2020, 5:34 AM
Calviղ
Calviղ - avatar
+ 1
Yes I have tried When code become heavy it becomes confusing
3rd Jul 2020, 5:35 AM
𝖆𝖊𝖙𝖍𝖊𝖗
𝖆𝖊𝖙𝖍𝖊𝖗 - avatar