call a function only once react