From b1a51b96a83f5c915c468f58f225c17204770fe5 Mon Sep 17 00:00:00 2001 From: Alejandro Lembke Barrientos Date: Mon, 9 Oct 2023 20:20:09 +0000 Subject: [PATCH] PR-206472: fixing readme and adding text from redux store in initial component --- README.md | 6 +-- package-lock.json | 4 +- package.json | 2 +- src/frontend/components/InitialComponent.tsx | 44 ++++++++++++-------- src/frontend/reducers/initialState.ts | 3 +- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index d7680f6..112ad98 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Tech(Library or Framework) | Version | --- | --- | React (Render Library) | 18.2.0 Redux (Global State Management) | 4.2.1 -React Router DOM (Routing) | 6.15.0 -Jest (Testing) | 29.6.4 -Cypress (E2E Testing) | 13.1.0 +React Router DOM (Routing) | 6.16.0 +Jest (Testing) | 29.7.0 +Cypress (E2E Testing) | 13.3.0 Typescript | 5.2.2 ## Setup diff --git a/package-lock.json b/package-lock.json index f072e5f..e9ce6d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aleleba/create-react-ssr", - "version": "3.9.11", + "version": "3.9.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@aleleba/create-react-ssr", - "version": "3.9.11", + "version": "3.9.12", "license": "MIT", "dependencies": { "@babel/register": "^7.22.15", diff --git a/package.json b/package.json index 7ccf850..ed742c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aleleba/create-react-ssr", - "version": "3.9.11", + "version": "3.9.12", "description": "Starter Kit of server side render of react", "bin": "./bin/cli.js", "main": "src/server/index", diff --git a/src/frontend/components/InitialComponent.tsx b/src/frontend/components/InitialComponent.tsx index 43b13d6..ec53ab6 100644 --- a/src/frontend/components/InitialComponent.tsx +++ b/src/frontend/components/InitialComponent.tsx @@ -1,25 +1,33 @@ import React from 'react'; import './InitialComponent.scss'; -import { Link } from "react-router-dom"; +import { connect } from 'react-redux'; +import { Link } from 'react-router-dom'; -const InitialComponent = () => ( -
-
- logo -

+const InitialComponent = ({ hello }: { hello: string }) => ( +

+
+ logo +

This is the text from the store of redux: {hello}

+

Edit src/frontend/InitialComponent.jsx and save to reload. -

- +

+
Learn React - - Other Component -
-
+ + Other Component +
+
); -export default InitialComponent; +const mapStateToProps = (state) => { + return { + hello: state.testReducer.hello + }; +}; + +export default connect(mapStateToProps)(InitialComponent); diff --git a/src/frontend/reducers/initialState.ts b/src/frontend/reducers/initialState.ts index 411deaa..faf326b 100644 --- a/src/frontend/reducers/initialState.ts +++ b/src/frontend/reducers/initialState.ts @@ -1,2 +1,3 @@ -const initialState = {}; +import { IInitialState } from './'; +const initialState: IInitialState = {}; export default initialState;