Harnessing the quantum computation power of the present noisy-intermediate-size-quantum devices has received tremendous interest in the last few years. Here we study the learning power of a one-dimensional long-range randomly-coupled quantum spin chain, within the framework of reservoir computing. In time sequence learning tasks, we find the system in the quantum many-body localized (MBL) phase holds long-term memory, which can be attributed to the emergent local integrals of motion. On the other hand, MBL phase does not provide sufficient nonlinearity in learning highly-nonlinear time sequences, which we show in a parity check task. This is reversed in the quantum ergodic phase, which provides sufficient nonlinearity but compromises memory capacity. In a complex learning task of Mackey-Glass prediction that requires both sufficient memory capacity and nonlinearity, we find optimal learning performance near the MBL-to-ergodic transition. This leads to a guiding principle of quantum reservoir engineering at the edge of quantum ergodicity reaching optimal learning power for generic complex reservoir learning tasks. Our theoretical finding can be readily tested with present experiments.