frankcollins3 / PHPokedex

react concepts
0 stars 0 forks source link

global state variable and utility function share a name [1:40pm] #3

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

check it out:

Screen Shot 2023-03-13 at 1 35 51 PM

proposed approaches:

easy to solve. One can just change the name of the utility function or change the name of the state.

i'd like to see if one could solve this by: giving the utility function import an alias so that it may be invoked under a different name,

this would of course mean that the utility function would technically no longer share the name of the global state variable.

global state: allpokemon (global state which will hold all of the pokemon objects retrieved from the pokeapi) allpokemonset (global state function that stores all pokemon as state. I'd like to have less utility functions if possible. )

utility function: allpokemon from allpokemon.ts

frankcollins3 commented 1 year ago

this isn't working Screen Shot 2023-03-13 at 1 41 51 PM

Screen Shot 2023-03-13 at 1 42 07 PM

[1:42pm]

frankcollins3 commented 1 year ago

Screen Shot 2023-03-13 at 1 45 51 PM

this is working but now the expression is coming back as uncallable [1:46pm]

frankcollins3 commented 1 year ago

solution was to change the name. This was working with the alias but I'd rather separate the concerns.

[2:00pm]