Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Billy - React challenge submission #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bulknskull
Copy link

Let me know if you need anything else!

const saveButtonClick = (renderForm, policyNumber) => {
console.log('In saveButtonClick')
// grab value of select and pass into dispatch as policyType
const select = document.getElementById('select-policy-type');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting approach to changing the select-policy-type element. Is there any reason why you didn't change the element with jsx, but instead chose a getElementById call?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Candidly, I was short on time and this was the most intuitive way for me! A little hacky, but first and foremost I just wanted to make sure I could get it done and implement the functionality.

case types.ADD_POLICY_TYPE: {
console.log('In ADD_POLICY_TYPE action');
policyTypes = state.policyTypes.slice();
policyTypes.push(action.payload);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this approach, you are keeping two copies of the policyTypes - one in the policies array and another in the policyTypes array. If you had more time, would you have done this differently?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding was that we wanted to keep both the policies array and the policyTypes array (both from provider.js) in the store. The policyTypes array in store felt redundant/unnecessary to me in general, but the prompt instructed me to import all the policy types from the policyTypes array in provider.js:

Both the policies array retrieved from getPolicies and the policyTypes array from getPolicyTypes should be stored in the redux store.

I may be misunderstanding your question, though!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants