Is there any way to fetch a salary component value from previous Salary slip to use it in Formula?
what data you need to fetch? what calculation do you need to carry out? provide more details in your post so that peope who read it can have context
you can write a server side function to fetch data using frappe.db.sql and return it, then call that function from js with the appropriate trigger that suits your need,