I understand that require loads the file only once, while load loads it every time it is called.
It looks like using require is preferable in most situations.
My question is, when would I use load rather than require ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you need to force something to reload (a common example would be a web server or a test server). You should use autoload when there is a reasonable chance some piece of code won’t get hit, or you want to address app load time issues. You should use require at all other times.