I can not figure out .map in react for the life of me. Someone please help?
I am learning react. I am trying to figure out how to use .maps.
So my scenerio is this. I am getting a nested Object from a MySql database. It is an Object because it is an Assoc Array which Javascript sees as an Object. As far as I can tell this is a given and nothing I can do about it.
The Object looks like this:
{ AA:[1,2,3,4], BB:[2,3,4,5], GD:[8,5,3,5. ... }
I want to make this into an Array so I can do neat things like finding out the length and accessing it. But I can not for the life of me figure out how to turn this into an array. I have been searching online for the last 5 hours and coming up with lots of maps examples that show how to do things like output it to the screen when you know the key value pairs and things like that but nothing explaining how to take a multidimensional object and turn it into a multidimensional array.
And I know that coming up in this project is another array three deep and I will need to know how to make that an array as well that I can store in useState.
{ AA:{ 342:{ ID: 34 Name: Bob } ... }
Can anyone explain in step by step "This is what this thing does" language how this is done while assuming I don't know much about JavaScript or react? I would be very grateful.
submitted by
rvrtex to
AskProgramming
Starting to collect postings under various topics related to the C language and C programming
Hi there,
I want to start to collect postings to
C_Programming under various topics related to (you guessed it) C programming. You can, of course, help me get more postings and more topics. Some time in the future we can make this an entry to the wiki.
translation uwu - an uwu translator in C https://old.reddit.com/C_Programming/comments/e36f0v/uwu_an_uwu_translator_in_c/ How can i deliberately cause the undefined behavior of violating the translation limit of identifiers w/ c89 and c90? https://old.reddit.com/C_Programming/comments/doyaxa/how_can_i_deliberately_cause_the_undefined/ Is there a way of translating JavaScript code to C? https://old.reddit.com/C_Programming/comments/e7zq9j/is_there_a_way_of_translating_javascript_code_to_c/ How does C deal with various operating systems having different new line returns (e.g unix '\n', windows '\r\n', mac '\r')? https://old.reddit.com/C_Programming/comments/f668s0/how_does_c_deal_with_various_operating_systems/ Why having a header file for declaring structs and function prototypes and a .c file with the code of functions? https://old.reddit.com/C_Programming/comments/enq9zo/why_having_a_header_file_for_declaring_structs/ Why does the "static" keyword have 2 seemingly different meanings depending on context? https://old.reddit.com/C_Programming/comments/etc1wx/why_does_the_static_keyword_have_2_seemingly/ Question regarding 1.0e-5 https://old.reddit.com/C_Programming/comments/fedx8p/question_regarding_10e5/ How to approach big c code base https://old.reddit.com/C_Programming/comments/ewcg33/how_to_approach_big_c_code_base/ Create DNS answer C language using structs https://old.reddit.com/C_Programming/comments/ef8ykg/create_dns_answer_c_language_using_structs/ Hiding helper functions in C https://old.reddit.com/C_Programming/comments/ec6wm2/hiding_helper_functions_in_c/ Is it best practice to return EXIT_SUCCESS/EXIT_FAILURE instead of 0/1 ? https://old.reddit.com/C_Programming/comments/efs0vg/is_it_best_practice_to_return_exit_successexit/ Why Header-Only Libraries Are a Bad Idea https://old.reddit.com/C_Programming/comments/cakxnv/why_headeronly_libraries_are_a_bad_idea/ Switch statement to handle return messages https://old.reddit.com/C_Programming/comments/cgqyay/switch_statement_to_handle_return_messages/ File size impact of tabs vs. spaces in C code (Linux Kernel, specifically) https://old.reddit.com/C_Programming/comments/auv5mg/file_size_impact_of_tabs_vs_spaces_in_c_code/ How to pass Strings to a struct? https://old.reddit.com/C_Programming/comments/c636un/how_to_pass_strings_to_a_struct/ identifier Using universal character names for identifiers https://old.reddit.com/C_Programming/comments/eewy25/using_universal_character_names_for_identifiers/ Why is the struct keyword required on variable declarations in C? https://old.reddit.com/C_Programming/comments/eus7ii/why_is_the_struct_keyword_required_on_variable/ Should functions be prefixed with some sort of identifier in anything other than a small one file program? https://old.reddit.com/C_Programming/comments/9nd6t7/should_functions_be_prefixed_with_some_sort_of/ Variable declaration, definition and initialization difference? https://old.reddit.com/C_Programming/comments/eu8a7p/variable_declaration_definition_and/ Comparing to char '\0' vs implicit comparison to identify end of string? https://old.reddit.com/C_Programming/comments/dunyst/comparing_to_char_0_vs_implicit_comparison_to/ The way C Programers explain pointers https://old.reddit.com/C_Programming/comments/ek53ma/the_way_c_programers_explain_pointers/ When would you ever NOT use header guards? https://old.reddit.com/C_Programming/comments/exkhrf/when_would_you_ever_not_use_header_guards/ Is there a way of translating JavaScript code to C? https://old.reddit.com/C_Programming/comments/e7zq9j/is_there_a_way_of_translating_javascript_code_to_c/ Limited Length for Identifiers https://old.reddit.com/C_Programming/comments/4d1hwo/limited_length_for_identifiers/ Why do so many (modern) beginner resources recommend char* pt instead of char *pt? https://old.reddit.com/C_Programming/comments/cn6pnwhy_do_so_many_modern_beginner_resources/ Why convention is "void *identifier" instead of "void* identifier" for defining variable. https://old.reddit.com/C_Programming/comments/4ndk6a/why_convention_is_void_identifier_instead_of_void/ A question on buffer overruns https://old.reddit.com/C_Programming/comments/eq21ph/a_question_on_buffer_overruns/ Need help generating stubs for missing functions https://old.reddit.com/C_Programming/comments/ebhvln/need_help_generating_stubs_for_missing_functions/ Can someone explain this passage from Dennis Ritchie's paper about the design of C? https://old.reddit.com/C_Programming/comments/dmrti6/can_someone_explain_this_passage_from_dennis/ Rob Pike: Notes on Programming in C https://old.reddit.com/C_Programming/comments/bahs4v/rob_pike_notes_on_programming_in_c/ How should/do you place your * for pointers? https://old.reddit.com/C_Programming/comments/bjf85y/how_shoulddo_you_place_your_for_pointers/ scope I implemented 'defer' (cf go, zig, or d) https://old.reddit.com/C_Programming/comments/f4gtkt/i_implemented_defer_cf_go_zig_or_d/ Is there anything wrong with this file copy program? How should it be improved? https://old.reddit.com/C_Programming/comments/f8e62i/is_there_anything_wrong_with_this_file_copy/ Simple static variable output question https://old.reddit.com/C_Programming/comments/f8zy3e/simple_static_variable_output_question/ Confused about compile-time constants https://old.reddit.com/C_Programming/comments/fa9x9o/confused_about_compiletime_constants/ Why does the "static" keyword have 2 seemingly different meanings depending on context? https://old.reddit.com/C_Programming/comments/etc1wx/why_does_the_static_keyword_have_2_seemingly/ Possibility of creating a plugin for either gcc or clang to support anonymous function https://old.reddit.com/C_Programming/comments/eoqb28/possibility_of_creating_a_plugin_for_either_gcc/ Declaring counter variables outside a loop vs. inside a loop: which is better practice? https://old.reddit.com/C_Programming/comments/eq6it8/declaring_counter_variables_outside_a_loop_vs/ Zeroing arrays on initialization? https://old.reddit.com/C_Programming/comments/enzu80/zeroing_arrays_on_initialization/ Why for loop was added to C when there is already a while loop? https://old.reddit.com/C_Programming/comments/e0xhja/why_for_loop_was_added_to_c_when_there_is_already/ Noob question about scope and where in memory variables live https://old.reddit.com/C_Programming/comments/a77auj/noob_question_about_scope_and_where_in_memory/ Array declaration https://old.reddit.com/C_Programming/comments/e8nmhw/array_declaration/ Should a function return a pointer or write to a buffer? https://old.reddit.com/C_Programming/comments/e4o8i2/should_a_function_return_a_pointer_or_write_to_a/ n00b question about using structures to avoid passing huge numbers of parameters as function arguments https://old.reddit.com/C_Programming/comments/dn7hrn/n00b_question_about_using_structures_to_avoid/ lifetime Optional and name-based arguments in C https://old.reddit.com/C_Programming/comments/f49k9x/optional_and_namebased_arguments_in_c/ Is C++17 RVO/copy-elision a part of standard C? https://old.reddit.com/C_Programming/comments/f1gktm/is_c17_rvocopyelision_a_part_of_standard_c/ [Beginner ]Why does it form infinite loop when i don't declare the variable "num" as static ? https://old.reddit.com/C_Programming/comments/epxn4w/beginner_why_does_it_form_infinite_loop_when_i/ Difference between int * t and int t[] https://old.reddit.com/C_Programming/comments/e0g5fg/difference_between_int_t_and_int_t/ Addresses change after assignment, and char* doesn't print correctly? https://old.reddit.com/C_Programming/comments/cvnyzd/addresses_change_after_assignment_and_char_doesnt/ Milkstrings: Strings in C which are easy to use, but have limited lifetime and length. To preserve put them in the fridge. https://old.reddit.com/C_Programming/comments/4xdovs/milkstrings_strings_in_c_which_are_easy_to_use/ What's an "object" anyway https://old.reddit.com/C_Programming/comments/aliooy/whats_an_object_anyway/ Pointer invalidation rules for storage reuse https://old.reddit.com/C_Programming/comments/9qsd5l/pointer_invalidation_rules_for_storage_reuse/ Using Designated Initializer with Array of Values https://old.reddit.com/C_Programming/comments/7e6c37/using_designated_initializer_with_array_of_values/ Need help understanding localtime() https://old.reddit.com/C_Programming/comments/6r71o1/need_help_understanding_localtime/ Is it possible to maintain stack frames when leaving functions? https://old.reddit.com/C_Programming/comments/5va7tb/is_it_possible_to_maintain_stack_frames_when/ lookup Does C have anything like C++ constexpr? https://old.reddit.com/C_Programming/comments/ebu0sy/does_c_have_anything_like_c_constexp fast lookup hash table? https://old.reddit.com/C_Programming/comments/6yaxvs/fast_lookup_hash_table/ ELF: symbol lookup via DT_HASH https://old.reddit.com/C_Programming/comments/67c92g/elf_symbol_lookup_via_dt_hash/ When are binary trees efficient? https://old.reddit.com/C_Programming/comments/ba4om5/when_are_binary_trees_efficient/ Help with optimization https://old.reddit.com/C_Programming/comments/c283n8/help_with_optimization/ Create function pointer from string? https://old.reddit.com/C_Programming/comments/c11a5g/create_function_pointer_from_string/ How do you ensure the right constants are used in the right place? https://old.reddit.com/C_Programming/comments/agcdbj/how_do_you_ensure_the_right_constants_are_used_in/ Storing key/value pairs in C? https://old.reddit.com/C_Programming/comments/8jo5m4/storing_keyvalue_pairs_in_c/ A struct with an array of the struct in itself? https://old.reddit.com/C_Programming/comments/56lkej/a_struct_with_an_array_of_the_struct_in_itself/ Best Data Structure? https://old.reddit.com/C_Programming/comments/6d0mwz/best_data_structure/ How to deal with old references to a resized hash table? https://old.reddit.com/C_Programming/comments/73lrz2/how_to_deal_with_old_references_to_a_resized_hash/ How bad is the performance loss from 'generic' data structure lack of locality https://old.reddit.com/C_Programming/comments/5rodk8/how_bad_is_the_performance_loss_from_generic_data/ How to access array by value instead of index? https://old.reddit.com/C_Programming/comments/53lk6o/how_to_access_array_by_value_instead_of_index/ Most frequent element in integer array https://old.reddit.com/C_Programming/comments/4jlxlu/most_frequent_element_in_integer_array/ Hash Table for Embedded Systems? https://old.reddit.com/C_Programming/comments/5gtfb9/hash_table_for_embedded_systems/ name spaces In Python, we have a "Zen of Python". What would you say is the "Zen of C"? https://old.reddit.com/C_Programming/comments/8qn5ti/in_python_we_have_a_zen_of_python_what_would_you/ Project structuring and 'namespacing'. What are the common/best practices? https://old.reddit.com/C_Programming/comments/6r2w93/project_structuring_and_namespacing_what_are_the/ Tips for avoiding name clashing in C? https://old.reddit.com/C_Programming/comments/cc24wn/tips_for_avoiding_name_clashing_in_c/ Struct with function pointer in header file. https://old.reddit.com/C_Programming/comments/c095sm/struct_with_function_pointer_in_header_file/ Reason Quake's sources use reserved "_t" postfix? https://old.reddit.com/C_Programming/comments/9ffx60/reason_quakes_sources_use_reserved_t_postfix/ Best way to "hide" functions used by macros? https://old.reddit.com/C_Programming/comments/8ve5mk/best_way_to_hide_functions_used_by_macros/ How to prevent potential symbol conflicts with customer code? https://old.reddit.com/C_Programming/comments/2k2nq9/how_to_prevent_potential_symbol_conflicts_with/ Library (access) design tradeoffs? https://old.reddit.com/C_Programming/comments/4s6loy/library_access_design_tradeoffs/ When is it appropriate to typedef? https://old.reddit.com/C_Programming/comments/3y96s5/when_is_it_appropriate_to_typedef/ Should functions be prefixed with some sort of identifier in anything other than a small one file program? https://old.reddit.com/C_Programming/comments/9nd6t7/should_functions_be_prefixed_with_some_sort_of/
submitted by
tinkerdaemon19 to
C_Programming