While updating item in SPFx I am getting below error:

Uncaught (in promise) TypeError: Cannot read property 'getByTitle' of undefined

enter image description here


1 Answer 1


Try using below imports before updating list items:

import { sp } from "@pnp/sp";
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import "@pnp/sp/items";


import { sp } from "@pnp/sp/presets/all";

Then you can update the list item like:

let list = sp.web.lists.getByTitle("Control Documents");

const i = await list.items.getById(itemId).update({
  BMSTwoApprovalStatus: "Retired",

Reference: @pnp/sp/items - Update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.