return err instead of throwing
use component-hooks