〜うちに is used to refer to a period of time. The period of time is represented by the modifier in front of うちに. Often 〜うちに is used when taking advantage of an opportunity.
See Also
- When contrasting with another period of time, 〜うちは is used.
Further Reading
- How to use うちに & うちは ( = uchi ni & uchiwa) (maggiesensei.com)