pass in function for store to get a new instance of it