Why use a server action in calcFactorial exercise
Question

Hi,

Just been completing an exercise on the react guided path and was wondering why they opted to  use a server function rather than a client action in this exercise?  Is it just to provide exposure to building server functions and calling them from a client action or is there another reason that I've perhaps missed?



Solution

Hello @JayPea 

It is the demonstration of how to call server action

Regards

Priyanka

Champion

Hi JayPea,

In that exercise, they just wanted to teach, how we can develop logic using an If, switch and how we can implement ad -hoc loop. 


You can opt client action and call it in your screen Factorial action.  So, Instead of choosing server action, you can make client action to calculate factorial. 

Thank you

,


LogicExercise_UsingClientAction.oml

Thanks Rahul,

It was a good exercise to effectively create a while loop. 

My question was more about the rationale behind why a server action was used? It could have been done with a client action.

Was it just to demonstrate how to call a server action from a client action or was there a deeper architectural reason for it. 

Thanks

Solution

Hello @JayPea 

It is the demonstration of how to call server action

Regards

Priyanka

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.