Offline React App – Advice on handling data and how to import documents

Sorry if this has been answered before or if it is something obvious, but I couldn’t even think what to search to get the answers that I need.

I’ve been learning React on the fly for a couple of years just by building projects as and when I needed it. This means there’s a bunch of gaps in my knowledge because I’ve just learned how to do things as and when I needed it. I have an odd situation and I wanted to establish the best approach to it using react (and any other tools recommended).

I want to make a completely offline React page. The aim of this project is to essentially create a form with a bunch of text fields / select options which when submitted, will produce a Word document which is generated based on the text fields / options selected. There’s a couple of things to note:

  1. The documents are 2-3 pages long and contain a lot of specific
    information (e.g. the user will select a client on the form,
    depending on the client, there’s different data for that client
    which will be inputted into the doc.
  2. It must be completely offline. The only place this will be stored is
    on a local shared network drive where a user can just open the .html file
    to see the form. There’s a ton of confidentiality hurdles which means I can’t have an express server, or use any sort of online based server to handle the data.

I’ve already built out maybe 50% of it, but as I’m creating it I keep thinking that there has to be a better way to do things. These are the main questions / things I could use help with.

  1. I’m using the docxjs library to create the word document. I have a
    base template with some images on / areas with placeholders where
    text is replaced. What is the best way to ‘import’ this .docx file,
    considering everything is offline and has no node backend. I tried using
    fetch at first then realized this wouldn’t work because it throws
    CORS errors. I don’t fully understand why if the .docx file is
    stored in the public folder, but after some searching it seemed that
    it isn’t possible. So I’ve resorted to converting the .docx file to
    base64, then I created a function which converts that to a docxjs
    supported format so I can patch the document.
  2. I have created a sort of ‘offline database’ by just storing a bunch of data in JSON objects in separate files the code. e.g. a clientData.js file which exports an object which contains an array of objects which has info on a load of clients. Right now I just import the object I need and use it to access the info when creating the document. In the future, I may want to make it so that certain people can update this info when needed, which would mean some kind of DB would be required. Is there any sort of DB which would work completely offline to store a large amount of data to be accessed and modified? I thought of something like sqlite but would this not give me similar issues to the .docx file I mentioned earlier?

I seen some talk about utilizing a serviceworker but this isn’t something I’ve used before. So also if there’s any guidance on how this could be utilized for this project that would be great.

Thanks

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật