Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
React bulk update documents using select all checkbox

Proper way to do bulk update of documents in react.

enter image description here

I want to bulk update all posts status and type fields in one single query how to achieve it.

Status and Type are dropdown select inputs.

All Posts Component:-

const AllPosts = () => {

    const [updateObj ,setUpdateObj] = useState({})

    handleUpdate(){

    }

  return (
    <>
      <div>
        {AllPosts.map((post, index) => (
          <Post
            key={post._id}
            postId={post._id}
            postStatus={post.status}
            postType={post.type}
            postSubject={post.subject}
            checked={post?.isChecked || false}
            onChange={handleAllChecked}
            checkBoxName={post._id}
          />
        ))}
      </div>
    </>
  );
};

export default AllPosts;

I think I would need an update object which would have post id as key and status and type as its value.

Post component

const Post = ({
  postId,
  postStatus,
  postType,
  postSubject,
  checked,
  onChange,
  checkBoxName,
}) => {


  return (
    <div className="post">
      <div className="post-checkbox">
        <input
          type="checkbox"
          id="post-checkbox"
          name={checkBoxName}
          checked={checked}
          onChange={onChange}
        />
      </div>
      <div>
          <div>{postSubject}</div>
          <div className="options">
              <select onChange={onChange}>
                  <option>Status A</option>
                  <option>Status B</option>
                  <option>Status C</option>
              </select>
              <select onChange={onChange}>
                  <option>Type A</option>
                  <option>Type B</option>
                  <option>Type C</option>
              </select>
          </div>
      </div>
      
    </div>
  );
};

export default Post;
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!